Fix: 훅에서 쿼리 안가져온 부분 수정
This commit is contained in:
parent
3e1e9bb23f
commit
04755eb526
@ -1,6 +1,5 @@
|
||||
import useAuthStore from '@/stores/useAuthStore';
|
||||
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||
import { getProfile } from '@/api/authApi';
|
||||
import useProfileQuery from '@/queries/useProfileQuery';
|
||||
|
||||
export function useHandleOAuthCallback() {
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
@ -8,12 +7,13 @@ export function useHandleOAuthCallback() {
|
||||
const setLoggedIn = useAuthStore((state) => state.setLoggedIn);
|
||||
const setProfile = useAuthStore((state) => state.setProfile);
|
||||
|
||||
accessToken && setLoggedIn(true, accessToken);
|
||||
if (accessToken) {
|
||||
setLoggedIn(true, accessToken);
|
||||
}
|
||||
|
||||
const { data: profile } = useSuspenseQuery({
|
||||
queryKey: ['profile'],
|
||||
queryFn: getProfile,
|
||||
});
|
||||
const { data: profile } = useProfileQuery();
|
||||
|
||||
if (profile) {
|
||||
setProfile(profile);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user