mise a jour

This commit is contained in:
Emma781227
2026-07-08 07:10:49 +02:00
parent 68a9650223
commit 65d6b23233
12 changed files with 603 additions and 182 deletions

View File

@@ -1,3 +1,4 @@
import { useCallback } from 'react'
import { useNavigate } from 'react-router-dom'
import { useAuth } from '../context/AuthContext'
@@ -5,12 +6,12 @@ export function useHandleAuthError() {
const { logout } = useAuth()
const navigate = useNavigate()
return function handleAuthError(err) {
return useCallback((err) => {
if (err.status === 401) {
logout()
navigate('/connexion')
return true
}
return false
}
}, [logout, navigate])
}