Merge branch 'style/loading' into 'dev'
Update loading on auth See merge request sae-but2/2025-26/gestion-benevoles-association/Frontend!89
This commit is contained in:
commit
560f391a03
1 file changed
+4
-1
+4
-1
@@ -5,13 +5,16 @@ import Background from "./components/Background/Background.jsx";
|
|||||||
import { Navigate } from "react-router";
|
import { Navigate } from "react-router";
|
||||||
import { useContext} from "react";
|
import { useContext} from "react";
|
||||||
import { AuthContext } from "./contexts/Auth/AuthContext.js";
|
import { AuthContext } from "./contexts/Auth/AuthContext.js";
|
||||||
|
import Loading from "./components/ui/Loading/Loading.tsx";
|
||||||
|
|
||||||
|
|
||||||
function Layout(){
|
function Layout(){
|
||||||
|
|
||||||
const { user, loading } = useContext(AuthContext);
|
const { user, loading } = useContext(AuthContext);
|
||||||
|
|
||||||
if (loading) return <p>Loading</p>;
|
if (loading) return <Background>
|
||||||
|
<Loading />
|
||||||
|
</Background>;
|
||||||
if (!user) return <Navigate to="/login" />;
|
if (!user) return <Navigate to="/login" />;
|
||||||
if(user && user.validate === 0) return <Navigate to="/error/validation" />;
|
if(user && user.validate === 0) return <Navigate to="/error/validation" />;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user