diff --git a/frontend/src/hooks/api/user.ts b/frontend/src/hooks/api/user.ts index 67df493b..79938db5 100644 --- a/frontend/src/hooks/api/user.ts +++ b/frontend/src/hooks/api/user.ts @@ -67,7 +67,7 @@ export const useGetUserQuery = () => { } }, [dispatch, query.data, query.isError, query.isSuccess]); - return query; + return { ...query, isLoading: query.isLoading || !axiosInterceptorAdded }; }; export const useUpdateUserNicknameMutation = () => { diff --git a/frontend/src/providers/AuthProvider.tsx b/frontend/src/providers/AuthProvider.tsx index 49db667d..1a1be25c 100644 --- a/frontend/src/providers/AuthProvider.tsx +++ b/frontend/src/providers/AuthProvider.tsx @@ -9,15 +9,14 @@ interface AuthProviderProps { function AuthProvider(props: AuthProviderProps) { const { children } = props; - const { data: user, isSuccess, isLoading, isPending } = useGetUserQuery(); + const { data: user, isSuccess, isLoading } = useGetUserQuery(); const shouldChangeNickname = useMemo( () => isSuccess && !user.nickname, [isSuccess, user?.nickname] ); - const isAuthLoading = isLoading || isPending; return ( - + {shouldChangeNickname ? : children} );