We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38fbc5a commit 1a018d0Copy full SHA for 1a018d0
src/hooks/admin/useGetUserInfo.ts
@@ -1,17 +1,14 @@
1
import { useQuery } from '@tanstack/react-query';
2
-import useAuthStore from '../../store/authStore';
3
import { ApiUserInfo } from '../../models/userInfo';
4
import { getUserInfo } from '../../api/userpage.api';
5
import { userInfoKey } from '../queries/keys';
6
7
const useGetUserInfo = (id: number) => {
8
- const isLoggedIn = useAuthStore.getState().isLoggedIn;
9
-
10
const { data, isLoading, isFetching } = useQuery<ApiUserInfo>({
11
queryKey: [userInfoKey.userProfile, id],
12
queryFn: () => getUserInfo(id),
13
staleTime: 1 * 60 * 1000,
14
- enabled: isLoggedIn,
+ enabled: !!id,
15
});
16
17
return { userData: data?.data, isLoading, isFetching };
0 commit comments