Skip to content

전남대 FE_임지환 5주차 과제#17

Open
dlawlghks wants to merge 25 commits intokakao-tech-campus-2nd-step2:dlawlghksfrom
dlawlghks:jihwan
Open

전남대 FE_임지환 5주차 과제#17
dlawlghks wants to merge 25 commits intokakao-tech-campus-2nd-step2:dlawlghksfrom
dlawlghks:jihwan

Conversation

@dlawlghks
Copy link
Copy Markdown

안녕하세요 멘토님.
5주체 과제 STEP1을 진행해보았습니다.
열심히 해보았지만, test 코드를 작성하는 것이 조금 미숙하다 보니 어려움이 있었습니다.

Goods/Detail/index.test.tsx 코드에서는 테스트가 잘 되었지만

Order/index.test.tsx 코드를 작성하는 도중 현금영수증 체크박스 상태에 따른 필드 활성화 상태를 확인하는 테스트에서 문제가 생겼습니다.

혹시 이 문제들을 해결하기 위해 제가 놓치고 있는 부분이 있을까요? 추가적으로 확인해봐야 할 사항이 있다면 조언 부탁드립니다.

항상 피드백 해주셔서 감사합니다.

dlawlghks added 25 commits July 24, 2024 23:29
@dlawlghks
Copy link
Copy Markdown
Author

멘토님 추가로 STEP2도 진행해보았습니다!
감사합니다.

@dlawlghks dlawlghks changed the title 전남대 FE_임지환 5주차 과제 step1 전남대 FE_임지환 5주차 과제 Jul 26, 2024
}

const storedUsers = JSON.parse(localStorage.getItem('users') || '[]');
const userExists = storedUsers.some((user: { id: string }) => user.id === id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컴포넌트가 렌더링 될 때마다 storedUsers.some 연산을 수행할 텐데요. useMemo 으로 메모이제이션 해주는게 좋을거 같습니다.

useEffect(() => {
const fetchWishlist = async () => {
if (authInfo) {
setLoading(true);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

authInfo 의 유무에 상관없이 loading 상태로 진입하는게 좋을거 같습니다.

setLoading(true);
try {
const response = await fetchInstance.get(
'/api/wishes?page=0&size=10&sort=createdDate,desc',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'/api/wishes?page=0&size=10&sort=createdDate,desc',
'/api/wishes', { params: { page: 0, size: 10, sort: 'createdDate,desc' } }

ref. https://axios-http.com/kr/docs/example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants