From c7384837c34fd74326c64031cce3d05f577d6210 Mon Sep 17 00:00:00 2001 From: Malopieds Date: Wed, 22 Oct 2025 11:18:10 +0200 Subject: [PATCH] fix: arthur issue --- src/pages/Dashboard.tsx | 153 ++++++++++++++++++++++------------------ 1 file changed, 86 insertions(+), 67 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 64b8ccc..fbc0309 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -9,9 +9,17 @@ function Dashboard() { const [dashboard, setDashboard] = useState(null); const username = localStorage.getItem("username"); useEffect(() => { - axios.get("/api/dashboard").then((res) => { - setDashboard(res.data); - }); + axios + .get("/api/dashboard") + .then((res) => { + setDashboard(res.data); + }) + .catch((err) => { + console.log(err); + if (err.response.status === 401 || err.response.status === 403) { + window.location.href = "/login"; + } + }); }, []); return ( @@ -28,73 +36,79 @@ function Dashboard() { {dashboard && ( <> - { dashboard.jiRespo.length !== 0 && ( -
-
-

- Immersions - Respo -

-
- {dashboard.jiRespo.map((jiRespo: Ji) => ( -
-
-

{jiRespo.name}

-

{jiRespo.description}

-
- - GO - + {dashboard.jiRespo.length !== 0 && ( +
+
+

+ Immersions - Respo +

+
+ {dashboard.jiRespo.map((jiRespo: Ji) => ( +
+
+

{jiRespo.name}

+

{jiRespo.description}

+
+ + GO + +
-
- ))} + ))} +
- -
-
- )} - { dashboard.sujetRespo.length !== 0 && ( -
-
-

Sujets - Respo

-
- {dashboard.sujetRespo.map((sujet: Sujet) => ( -
-
-

{sujetRespo.name}

- {sujetRespo && ( -

Linked to: {sujetRespo.name}

- )} -
- {false && ( - - Learn More - - )} +
+ )} + {dashboard.sujetRespo.length !== 0 && ( +
+
+

+ Sujets - Respo +

+
+ {dashboard.sujetRespo.map((sujet: Sujet) => ( +
+
+

{sujetRespo.name}

{sujetRespo && ( - - See TP - +

+ Linked to: {sujetRespo.name} +

)} +
+ {false && ( + + Learn More + + )} + {sujetRespo && ( + + See TP + + )} +
-
- ))} + ))} +
- -
+ )}
@@ -111,7 +125,10 @@ function Dashboard() {

{jiParticipant.name}

{jiParticipant.description}

- + Learn More
@@ -120,13 +137,15 @@ function Dashboard() { ))}
{dashboard.jiParticipant.length === 0 && ( -
-

You are not registered on any activities.

-
+
+

+ You are not registered on any activities. +

+
)}
-
+

Messages

You have no messages