mise a jour

This commit is contained in:
Emma781227
2026-07-01 22:06:22 +02:00
parent efd10d6754
commit 68a9650223
22 changed files with 719 additions and 167 deletions

View File

@@ -0,0 +1,16 @@
import { useNavigate } from 'react-router-dom'
import { useAuth } from '../context/AuthContext'
export function useHandleAuthError() {
const { logout } = useAuth()
const navigate = useNavigate()
return function handleAuthError(err) {
if (err.status === 401) {
logout()
navigate('/connexion')
return true
}
return false
}
}