codestates / codestates/MUNADU-client

[Dev-Log] 5월 26일 수요일 / 류제천

Open
#98 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

### 오늘은 어떻게 프로젝트에 기여했나요?
* 리뷰 생성/수정/삭제 시 새로고침 필요없이 자동으로 리렌더링 될 수 있도록 함수 컴포넌트 내부에서 사용하는 axios명령을 리덕스 툴킷을 사용하도록 리팩토링 완료
* 메인페이지의 무술전체보기 메뉴 구현
### 오늘의 프로젝트에서 힘든 점은 무엇인가요?
* Post나 Put으로 서버요청 시에도 Redux Store에 데이터를 저장하는 과정에서 많이 헤맸다. 어떻게 하면 리덕스 state 값을 DB와 동일하게 데이터값을 유지할 수 있을 지 고민하다가 아래 코드처럼 req.body 와 서버의 res를 합쳐서 return 하면 리덕스 툴킷의 action.payload 객체를 통해 state 값을 업데이트 할 수 있었다.
```js
export const createReview = createAsyncThunk(
"reviewReducer/createReview",
async ({
period,
comment,
score,
practicality,
muscle,
difficulty,
intensity,
injury,
Martials_id,
Users_id,
accessToken,
}: CreateProps) => {
const resp = await axios.post(
`${process.env.REACT_APP_API_URL}/review/create`,
{
period,
comment,
score,
practicality,
muscle,
difficulty,
intensity,
injury,
Martials_id,
Users_id,
},
{
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
withCredentials: true,
}
);
// 아래와 같이 서버에서 응답하는 데이터와 서버에 요청할 때 body 데이터를 합쳐서 return 가능
return {
...resp.data.data,
period,
comment,
score,
practicality,
muscle,
difficulty,
intensity,
injury,
Martials_id,
Users_id,
};
}
);
```

### 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?
- [ ] 메인페이지의 전체무술보기 메뉴에서 태그버튼 클릭할 때 마다 그에 따른 무술필터링 및 리렌더링 기능 구현
- [ ] 리뷰에 댓글 달고 수정, 삭제하는 기능 구현

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.