-
Notifications
You must be signed in to change notification settings - Fork 40
[이준희] Sprint12 #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[이준희] Sprint12 #346
The head ref may contain hidden characters: "Next-\uC774\uC900\uD76C-sprint12"
Conversation
jyh0521
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
| const handleChange = (name: string, value: any) => { | ||
| setValues((initialValues) => ({ | ||
| ...initialValues, | ||
| setValues((prevState) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좀 더 직관적인 이름으로 잘 수정해주셨네요~
| const [pageSize, setPageSize] = useState<number>(() => | ||
| getPageSize("article") | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useState 내부에 콜백 함수 잘 사용해주셨네요.
| (error) => Promise.reject(error) | ||
| ); | ||
|
|
||
| instance.interceptors.response.use( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interceptor 기능을 잘 활용해주셨네요!
|
|
||
| if (status === 401) { | ||
| // 로컬 스토리지에서 토큰 제거 | ||
| localStorage.removeItem("accessToken"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localStorage에서 사용하는 키 값도 상수로 관리해주셔도 좋을 것 같습니다.
| if (typeof window === "undefined") { | ||
| return context === "default" ? 3 : 10; | ||
| } | ||
|
|
||
| if (context === "item") { | ||
| if (width < 768) return 1; | ||
| if (width < 1280) return 2; | ||
| return 4; | ||
| } | ||
| const width = window.innerWidth; | ||
| const size = pageSize[context]; | ||
|
|
||
| if (width < 768) return 4; | ||
| if (width < 1280) return 6; | ||
| return 10; | ||
| if (width < 768) return size.small; | ||
| if (width < 1280) return size.medium; | ||
| return size.large; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수를 잘 활용해서 코드가 많이 줄어든 것 같습니다.
|
|
||
| const formData = new FormData(); | ||
| formData.append("name", values.name); | ||
| formData.append("favorite", values.favoriteCount.toString()); | ||
| formData.append("description", values.description); | ||
| formData.append("price", values.price.toString()); | ||
|
|
||
| if (values.images) { | ||
| values.images.forEach((image, index) => { | ||
| formData.append(`images[${index}]`, image); | ||
| }); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개행 잘해주셔서 가독성이 더 좋아진 것 같습니다.
요구사항
기본
중고마켓
상품 상세
상품 등록
심화
주요 변경사항
스크린샷
멘토에게