diff --git a/client/components/providers/LoginProvider.tsx b/client/components/providers/LoginProvider.tsx index ee61d42..a5f6d80 100644 --- a/client/components/providers/LoginProvider.tsx +++ b/client/components/providers/LoginProvider.tsx @@ -1,6 +1,6 @@ import { Href, useRouter } from 'expo-router' import { useRouteInfo } from 'expo-router/build/hooks' -import { ReactNode, useEffect } from 'react' +import React, { ReactNode, useEffect } from 'react' import { useAuth, useAuthLogin } from '@/hooks/useAuth' import * as SecureStore from '@/utils/SecureStore' import { useLoginMutation } from '@/hooks/mutations/useLoginMutation' @@ -47,7 +47,7 @@ export default function LoginProvider({ loginRedirect, children }: Props) { // Renouvellement auto du jeton d'authentification const { name, token } = auth const password = SecureStore.getItem('apiPassword') - if (name === null || (password === null && token === null)) + if (name === null || (password === null && token === null) || loginMutation.isPending) return let waitTime = 0 if (token !== null && token !== undefined) { @@ -69,7 +69,7 @@ export default function LoginProvider({ loginRedirect, children }: Props) { authLogin({ name: name, token: null }) }, waitTime) return () => clearTimeout(timeout) - }, [auth, authLogin, game, setPlayerId]) + }, [auth, authLogin, loginMutation.status, game, setPlayerId]) return <> {children}