Loading
This commit is contained in:
1 parent
da1d5a5b63
commit
ffddef9845
1 file changed
+7
-1
@@ -1,11 +1,17 @@
|
|||||||
import { Navigate, Outlet } from 'react-router-dom';
|
import { Navigate, Outlet } from 'react-router-dom';
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
|
import { Loader2 } from 'lucide-react';
|
||||||
|
|
||||||
const ProtectedRoute = () => {
|
const ProtectedRoute = () => {
|
||||||
const { user, loading } = useAuth();
|
const { user, loading } = useAuth();
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="loading-state">Vérification de la session...</div>;
|
return (
|
||||||
|
<div className="fixed inset-0 flex flex-col items-center justify-center bg-background gap-4 animate-in fade-in duration-500">
|
||||||
|
<Loader2 className="w-10 h-10 text-primary animate-spin" />
|
||||||
|
<p className="text-sm font-medium text-muted-foreground animate-pulse">Vérification de la session...</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
|||||||
Reference in new issue
Block a user