Skip to content

Commit

Permalink
Merge pull request #101 from Beside-Potenday/seungbeom
Browse files Browse the repository at this point in the history
fix: 버그 수정
  • Loading branch information
seung365 authored Aug 8, 2024
2 parents 313a981 + 4eac6c0 commit ad965e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/api/hooks/Mail/useGetMail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
};
2 changes: 1 addition & 1 deletion src/pages/MyPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const MyPage = () => {
{mailLoading ? (
<Spinner />
) : mailError ? (
<Text color="red.500">오류가 발생했습니다.</Text>
<Text>메일이 없습니다!</Text>
) : (
mailData?.content.map((email, index) => (
<Box key={email.createDate} w="100%">
Expand Down

0 comments on commit ad965e4

Please sign in to comment.