-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Fix] Stopwatch bug fix and useMutatuinHandleErorr hook 추가 #471
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
# Conflicts: # src/apis/record.ts
onError: (error: any) => { | ||
if (error.response.data.data.errorClassName === 'MISSION_RECORD_ALREADY_EXISTS_TODAY') { | ||
removeProgressMissionData(); | ||
router.replace(ROUTER.HOME); | ||
} | ||
}, |
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.
isSeverError util 을 쓰면 sever 데이터 타입 추론되게 할 수 있을 것 같아요
(eslint-disable-next-line @typescript-eslint/no-explicit-any 사용하지 않을 수 있음)
onError: (error: any) => { | |
if (error.response.data.data.errorClassName === 'MISSION_RECORD_ALREADY_EXISTS_TODAY') { | |
removeProgressMissionData(); | |
router.replace(ROUTER.HOME); | |
} | |
}, | |
onError: (error) => { | |
if(!isSeverError(error)) { | |
return | |
} | |
if (error.response.data.data.errorClassName === 'MISSION_RECORD_ALREADY_EXISTS_TODAY') { | |
removeProgressMissionData(); | |
router.replace(ROUTER.HOME); | |
} | |
}, |
import { useSnackBar } from '@/components/SnackBar/SnackBarProvider'; | ||
import { useMutation, type UseMutationOptions } from '@tanstack/react-query'; | ||
|
||
interface SnackBarOptions { |
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.
마이너) 실제 스넥바의 interface와 같이 연결되면 좋을것 같아서 triggerSnackBar 의 argment 타입인 SnackBarWithoutId 라눈 타입에서 Omit 이나 Pick 을 이용해서 사용하면 좋을 것 같아요
const { triggerSnackBar } = useSnackBar(); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const triggerServerErrorSnackBar = (error: any) => { |
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.
여기 error 에 any 타입선언이 안필요하다고 생각되는데 꼭 필요한 걸까요?
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.
unknwon으로 변경했습니당
} | ||
|
||
function useMutationHandleError<T, _unknown, V>( | ||
options?: UseMutationOptions<T, unknown, V>, |
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.
제네릭 너무 좋습니다 굿굿
# Conflicts: # src/app/search/page.tsx
🤔 해결하려는 문제가 무엇인가요?