Skip to content

Commit 21beb01

Browse files
committed
feat: 토큰이 없으면 user 정보 불러오는 함수 작동하지 않도록 제한
1 parent 8db3c68 commit 21beb01

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/api/domain/signup/hook/useGetUser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { getUser } from '@/api/domain/signup';
44
import { QUERY_KEY } from '@/api/constant/queryKey';
55

66
export const useGetUser = () => {
7+
const token = localStorage.getItem('accessToken');
8+
79
return useQuery({
810
queryKey: QUERY_KEY.USER_INFO,
911
queryFn: getUser,
12+
enabled: !!token,
1013
});
1114
};

0 commit comments

Comments
 (0)