diff --git a/src/pages/userProfile.tsx b/src/pages/userProfile.tsx
index 57d0708..b7609fc 100644
--- a/src/pages/userProfile.tsx
+++ b/src/pages/userProfile.tsx
@@ -61,10 +61,6 @@ export default function UserProfile() {
const { data: session, status } = useSession();
- // if (status === "unauthenticated") router.push("/login");
-
- // if (status === "authenticated") {
-
const {
isLoading,
isError,
@@ -85,10 +81,17 @@ export default function UserProfile() {
});
if (isLoading) {
+ if (status === "unauthenticated") router.push("/login");
return ;
}
if (isError) {
+ toast({
+ title: `Erreur lors de la récupération des données du profil`,
+ status: "error",
+ position: "top",
+ });
+ if (status === "unauthenticated") router.push("/");
return Error: {error.message};
}