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

@@ -1,10 +1,10 @@
import { Navigate } from 'react-router-dom'
import { useAuth } from '../context/AuthContext'
export default function ProtectedRoute({ children, roles }) {
const token = localStorage.getItem('token')
const user = JSON.parse(localStorage.getItem('user') || 'null')
const { user } = useAuth()
if (!token || !user) {
if (!user) {
return <Navigate to="/connexion" replace />
}