From 1fd8824810d9286c91e65dffa16e952f3ecc35bc Mon Sep 17 00:00:00 2001 From: David Lyon Date: Mon, 21 Oct 2024 15:38:12 -0700 Subject: [PATCH] Fix initial auth/me call, skip query until token is defined --- src/features/auth/hooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/auth/hooks.ts b/src/features/auth/hooks.ts index ec32def7..84891939 100644 --- a/src/features/auth/hooks.ts +++ b/src/features/auth/hooks.ts @@ -14,7 +14,7 @@ import { export const useAuthMe = () => { const dispatch = useAppDispatch(); const token = useAppSelector(authToken) || ''; - const authAPIQuery = getMe.useQuery({ token }); + const authAPIQuery = getMe.useQuery({ token }, { skip: !token }); useEffect(() => { if (authAPIQuery && authAPIQuery.isSuccess && authAPIQuery.data) { const data = authAPIQuery.data;