codestates / codestates/WeaDresser
[Dev Log] 2021-12-19(일) / 설동혁
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
---
### 오늘은 어떻게 프로젝트에 기여했나요?
- 현재까지 작업하였던 LandingPage, DiaryPage, RecordPage에 대한 전반적인 오류 발생에 대한 핸들링과 CSS 디자인을 일부 수정하였다.
### 오늘의 프로젝트에서 힘든 점은 무엇인가요?
- RecordPage에서 글을 작성한 후 DiaryPage로 useHistory를 이용하여 이동하게 설정을 해주었으나 방금 내가 작성한 글이 바로 보여지지 않고 새로고침을 한 번 한 후조회가 되었다.
아무래도 useHistory를 사용하면 작성한 글이 post요청을 하고 난 후 바로 DiaryPage에서 get요청을 하여 비동기적으로 작동이 되지 않았음을 알았고 첫번째 then에서는 데이터를 전송하고 두번째 then에서 useHistory를 사용하여 작성한 글이 바로 다음 페이지에서 볼 수 있었다.
```js
function submitFn (e) { // 작성완료 함수
e.preventDefault();
formData.append('image', uploadImage);
formData.append('content', inputContent);
formData.append('hashtag', inputHashtag);
formData.append('share', sharePost);
formData.append('weather', curWeather);
formData.append('tempMin', Math.round(curTempMin * 10 / 10).toFixed(1));
formData.append('tempMax', Math.round(curTempMax * 10 / 10).toFixed(1));
formData.append('temp', curTemp);
const url = process.env.REACT_APP_SERVER_URL || 'http://localhost:80'
axios.post(`${url}/diary`, formData, { withCredentials: true}) // 완료된 글이 post요청
.then(res => console.log('submit successfully')) // post요청이 성공하면 다음과 같은 성공확인 메시지 확인 가능
.then(() => history.push('/mypage')) // 위의 요청이 완료 된 후 마이페이지로 이동
.catch(err => console.log('error!!', err));
}
```
### 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?
- [x] 배포된 웹에서 기능구현이나 UX부분에 대한 세부 수정을 팀원들과 지속적으로 확인
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.