From 55aff5f900bac23e0bc68b41f2ddb4aa7456cbfe Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Tue, 17 Dec 2024 21:14:51 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20appels=20multiples=20=C3=A0=20la?= =?UTF-8?q?=20connexion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/providers/LoginProvider.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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}