From 4eac6c0992a59f25081841d89ea54e6b7626ebf3 Mon Sep 17 00:00:00 2001 From: seung365 Date: Thu, 8 Aug 2024 13:31:10 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hooks/Mail/useGetMail.tsx | 6 +++++- src/pages/MyPage/index.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/hooks/Mail/useGetMail.tsx b/src/api/hooks/Mail/useGetMail.tsx index c0414e7..768c949 100644 --- a/src/api/hooks/Mail/useGetMail.tsx +++ b/src/api/hooks/Mail/useGetMail.tsx @@ -34,9 +34,13 @@ export const useGetMail = (page: number, size: number, job: string) => { data: mailData, isLoading: mailLoading, isError: mailError, + refetch, } = useQuery({ queryKey: ['emails', page, size, job], queryFn: () => getMail(page, size, job), + enabled: !!job, // job이 존재할 때만 쿼리 실행 + retry: 1, // 에러 시 1번만 재시도 }); - return { mailData, mailLoading, mailError }; + + return { mailData, mailLoading, mailError, refetch }; }; diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 93eb4f9..8c0366a 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -72,7 +72,7 @@ export const MyPage = () => { {mailLoading ? ( ) : mailError ? ( - 오류가 발생했습니다. + 메일이 없습니다! ) : ( mailData?.content.map((email, index) => (