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