Correction appels multiples à la connexion
This commit is contained in:
parent
afcb5427af
commit
55aff5f900
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user