Skip to content

Commit

Permalink
SKRF-462 fix: 비로그인 시 profile 요청 x (#223)
Browse files Browse the repository at this point in the history
* fix: 비로그인 시 profile 요청 x

* fix: 비로그인 시 clubs 요청 x
  • Loading branch information
colorkite10 authored Dec 1, 2023
1 parent c8aec36 commit b70ddd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hooks/query/club/useClubs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import getMyClubs from '@/apis/users/getMyClub';
import { getStorage } from '@/utils/localStorage';

import { useQuery } from '@tanstack/react-query';

Expand All @@ -7,10 +8,12 @@ export const QUERY_KEY = {
};

const useClubs = () => {
const token = getStorage('token');
const { data, isLoading } = useQuery({
queryFn: () => getMyClubs(),
queryKey: [QUERY_KEY.MY_CLUB],
staleTime: 1000 * 60,
enabled: !!token,
});

return { clubs: data, isLoading };
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/query/user/useMyProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const QUERY_KEY = {
};

const useMyProfile = ({ setValue }: useMyProfile = {}) => {
const token = getStorage('token');
const { data } = useQuery({
queryKey: [QUERY_KEY.MY_PROFILE, QUERY_KEY.ID],
queryFn: () => getMyProfileInfo(),
Expand All @@ -25,6 +26,7 @@ const useMyProfile = ({ setValue }: useMyProfile = {}) => {
setValue('number', phoneNumber);
}
},
enabled: !!token,
});

return { data };
Expand Down

0 comments on commit b70ddd8

Please sign in to comment.