-
Notifications
You must be signed in to change notification settings - Fork 3
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
[BugFix] label 및 sprint 이름 중복시 예외처리 추가 및 toast 추가 #152
Conversation
가# ▼ <빈 줄>
@@ -0,0 +1,27 @@ | |||
import { useTheme } from 'next-themes'; |
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.
이 부분은 shadcn/ui 의 sonner 를 사용한 부분입니다.
리뷰 대상이 아닙니다.
|
||
interface CreateLabelProps { | ||
onCreate: (data: LabelFormValues) => void; | ||
createMutation: UseMutationResult<BaseResponse, AxiosError, CreateLabelDto>; |
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.
외부에서 한번 mutation 을 wrapping 해서 사용했었는데,
onSuccess, onError 등을 내부에서 사용하는 편이 보기 좋아보여서, 이렇게 수정했습니다.
const onError = (error: AxiosError) => { | ||
if (error?.response?.status === 409) { | ||
setError('name', { | ||
message: 'Label with this name already exists', |
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.
이 에러 메세지들은 나중에 하나의 객체로 분리하면 더 좋을 것 같습니다.
create: useMutation({ | ||
mutationFn: (createLabelDto: CreateLabelDto) => | ||
projectAPI.createLabel(projectId, createLabelDto), | ||
create: useMutation<BaseResponse, AxiosError, CreateLabelDto>({ |
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.
useMutation 에 제너릭 타입을 추가하니,
개별 인자에 타입을 설정하지 않는 것이 좋더라고요!
@@ -132,6 +137,7 @@ function AuthLayout() { | |||
} | |||
/> | |||
<Outlet /> | |||
<Toaster position="bottom-left" /> |
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.
planning-poker 기능과 겹칠 것을 대비해서,
좌측 하단으로 설정해뒀습니다.
<div className="flex items-center gap-2"> | ||
<h2>{params.project ?? 'My Account'}</h2> | ||
<h2>{(params.project && currentProject?.title) ?? 'My Account'}</h2> |
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.
이 레이아웃에서 이미 프로젝트 정보를 가지고 있어서, 해당 정보를 이용해 title 정보를 가져왔습니다.
createMutation: UseMutationResult<BaseResponse, AxiosError, CreateSprintDto>; | ||
} | ||
|
||
const 일주일 = 7 * 24 * 60 * 60 * 1000; |
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.
❓
이것만 한글 변수 명을 사용한 이유가 있나요 ?!
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.
마스터 클래스 때, week
aweek
이런 변수명은 잘 안읽힌다. 라는 이야기를 해주신 적이 있어서
한번 적용해봤습니다.
근데 로고 옆에 / 이거 없는게 더 괜찮은 것 같아요!! |
vercel 을 최대한 따라했습니다. 너무 딱 붙는 느낌이라 연한톤으로 바꿔보겠습니다. |
관련 이슈 번호
close #149
작업 내용
고민과 학습내용
useMutation 의 제너릭 타입 설정에 대해 다시 배웠습니다.
매번 인자에 넘겨주고 있었는데, 제너릭 타입을 설정해두니, 그럴 필요가 없어졌습니다.
역시, 공식문서가 최곱니다.
스크린샷
2024-11-26.3.31.00.mov
(현재 라벨 및 스프린트의 API 에서 409 Conflict 가 보내지지 않아 폼 영역 이슈로 뜨지 않습니다.
다만, 그 부분 수정되면 바르게 동작할 것입니다)