[함헌규] sprint12#145
Open
heonq wants to merge 5 commits intocodeit-sprint-fullstack:next-함헌규from
Hidden character warning
The head ref may contain hidden characters: "next-\ud568\ud5cc\uaddc-sprint12"
Open
Conversation
pers0n4
approved these changes
Feb 27, 2025
Comment on lines
+69
to
+85
| onSuccess: () => { | ||
| if (initialValue) { | ||
| const changedFields: Partial<CreateProductRequest> = {}; | ||
| if (data.name !== initialValue.name) changedFields.name = data.name; | ||
| if (data.description !== initialValue.description) | ||
| changedFields.description = data.description; | ||
| if (data.price !== initialValue.price) | ||
| changedFields.price = data.price; | ||
| if (Object.keys(changedFields).length > 0) | ||
| return (mutation as EditMutation).mutate(changedFields); | ||
| } | ||
| return (mutation as CreateMutation).mutate({ | ||
| ...data, | ||
| images: [`https://${imageUrl}`], | ||
| }); | ||
| }, | ||
| }); |
Contributor
There was a problem hiding this comment.
함수 구현체가 길어지면 인라인 콜백으로 사용하는 대신 함수를 따로 정의해보면 가시성을 높일 수 있을 것 같다는 면에서 좋아 보여요.
Comment on lines
+72
to
+76
| if (data.name !== initialValue.name) changedFields.name = data.name; | ||
| if (data.description !== initialValue.description) | ||
| changedFields.description = data.description; | ||
| if (data.price !== initialValue.price) | ||
| changedFields.price = data.price; |
Contributor
There was a problem hiding this comment.
비슷한 모양의 코드가 반복되는데 반복문이나 함수형 프로그래밍적으로 접근해보면 어떨까요?
| async (error) => { | ||
| const originalRequest = error.config; | ||
|
|
||
| if (originalRequest.url === 'auth/refresh-token') { |
Contributor
There was a problem hiding this comment.
직관적으로 파악하기 힘든 조건의 경우는 변수 또는 함수로 추상화해주면 파악하기 쉬워질 것 같아요.
e.g.
const hasRefreshTokenRequestFailed = originalRequest.url === 'auth/refresh-token'
if (hasRefreshTokenRequestFailed) {}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요구사항
기본
프론트엔드 배포
주요 변경사항