From 7342ac06e0b454c2523bc830d1605d9a8e135b85 Mon Sep 17 00:00:00 2001 From: Hyelim Choi Date: Mon, 14 Oct 2024 13:37:05 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EB=B3=80=EA=B2=BD=EB=90=9C=20?= =?UTF-8?q?=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/query/useToggleLikeQuery.ts | 2 +- frontend/src/hooks/useMutateChecklist.ts | 6 +++--- frontend/src/hooks/useToast.test.ts | 8 ++++---- frontend/src/pages/CategoryChoosePage.tsx | 2 +- frontend/src/pages/ChecklistQuestionSelectPage.tsx | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/frontend/src/hooks/query/useToggleLikeQuery.ts b/frontend/src/hooks/query/useToggleLikeQuery.ts index 5f66f9a0a..fb0ffb7f6 100644 --- a/frontend/src/hooks/query/useToggleLikeQuery.ts +++ b/frontend/src/hooks/query/useToggleLikeQuery.ts @@ -20,7 +20,7 @@ const useToggleLikeQuery = () => { queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.CHECKLIST] }); }, onError: () => { - showToast('좋아요를 처리하는 중 문제가 발생했습니다. 나중에 다시 시도해주세요.'); + showToast({ message: '좋아요를 처리하는 중 문제가 발생했습니다. 나중에 다시 시도해주세요.', type: 'error' }); invalidateChecklistListQuery(); queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.CHECKLIST] }); }, diff --git a/frontend/src/hooks/useMutateChecklist.ts b/frontend/src/hooks/useMutateChecklist.ts index 147cdad31..7b5dfdac0 100644 --- a/frontend/src/hooks/useMutateChecklist.ts +++ b/frontend/src/hooks/useMutateChecklist.ts @@ -18,7 +18,7 @@ const useMutateChecklist = ( onErrorCallback?: () => void, ) => { const navigate = useNavigate(); - const { showToast } = useToast({ type: 'positive' }); + const { showToast } = useToast(); const { mutate: addChecklist } = useAddChecklistQuery(); const { mutate: putChecklist } = usePutChecklistQuery(); @@ -76,7 +76,7 @@ const useMutateChecklist = ( const postNewChecklist = () => { addChecklist(postData, { onSuccess: res => { - showToast(TOAST_MESSAGE.ADD); + showToast({ message: TOAST_MESSAGE.ADD }); roomInfoActions.resetAll(); roomInfoUnvalidatedActions.resetAll(); if (onSuccessCallback) { @@ -99,7 +99,7 @@ const useMutateChecklist = ( const putEditedChecklist = () => { putChecklist(putData, { onSuccess: res => { - showToast(TOAST_MESSAGE.EDIT); + showToast({ message: TOAST_MESSAGE.EDIT }); roomInfoActions.resetAll(); roomInfoUnvalidatedActions.resetAll(); if (onSuccessCallback) { diff --git a/frontend/src/hooks/useToast.test.ts b/frontend/src/hooks/useToast.test.ts index 25f546a2d..a6768e181 100644 --- a/frontend/src/hooks/useToast.test.ts +++ b/frontend/src/hooks/useToast.test.ts @@ -15,7 +15,7 @@ describe('useToast 테스트', () => { const { result } = renderHook(() => useToast({ durationMinute: TOAST_DURATION_MINUTE })); act(() => { - result.current.showToast(TOAST_MESSAGE); + result.current.showToast({ message: TOAST_MESSAGE }); }); expect(result.current.toast).toBe(TOAST_MESSAGE); @@ -25,7 +25,7 @@ describe('useToast 테스트', () => { const { result } = renderHook(() => useToast({ durationMinute: TOAST_DURATION_MINUTE })); act(() => { - result.current.showToast(TOAST_MESSAGE); + result.current.showToast({ message: TOAST_MESSAGE }); }); expect(result.current.toast).toBe(TOAST_MESSAGE); await waitFor(() => expect(result.current.toast).toBe(null), { timeout: 200, interval: 10 }); @@ -36,8 +36,8 @@ describe('useToast 테스트', () => { const CHANGED_TOAST_MESSAGE = '토스트가 바뀌었다.'; act(() => { - result.current.showToast(TOAST_MESSAGE); - result.current.showToast(CHANGED_TOAST_MESSAGE); + result.current.showToast({ message: TOAST_MESSAGE }); + result.current.showToast({ message: CHANGED_TOAST_MESSAGE }); }); expect(result.current.toast).toBe(CHANGED_TOAST_MESSAGE); diff --git a/frontend/src/pages/CategoryChoosePage.tsx b/frontend/src/pages/CategoryChoosePage.tsx index c26e36df7..5ac1bb7a3 100644 --- a/frontend/src/pages/CategoryChoosePage.tsx +++ b/frontend/src/pages/CategoryChoosePage.tsx @@ -37,7 +37,7 @@ const CategoryChoosePage = () => { } else if (prev.length < MAX_SELECT_CATEGORY_COUNT) { return [...prev, id]; } - showToast(TOAST_MESSAGE.MAX_SELECT); + showToast({ message: TOAST_MESSAGE.MAX_SELECT }); return prev; }); }; diff --git a/frontend/src/pages/ChecklistQuestionSelectPage.tsx b/frontend/src/pages/ChecklistQuestionSelectPage.tsx index 9788cd291..c94d8fd86 100644 --- a/frontend/src/pages/ChecklistQuestionSelectPage.tsx +++ b/frontend/src/pages/ChecklistQuestionSelectPage.tsx @@ -28,13 +28,13 @@ const ChecklistQuestionSelectPage = () => { const handleSubmitChecklist = () => { if (!selectedQuestions.length) { - showToast(TOAST_MESSAGE.MIN_CUSTOM_SELECT); + showToast({ message: TOAST_MESSAGE.MIN_CUSTOM_SELECT }); return; } putCustomChecklist(selectedQuestions, { onSuccess: () => { - showToast(TOAST_MESSAGE.CUSTOM); + showToast({ message: TOAST_MESSAGE.CUSTOM }); navigate(ROUTE_PATH.checklistList); }, });