mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
fix(redirect when unauthenthicated): authenticated
This commit is contained in:
@@ -61,10 +61,6 @@ export default function UserProfile() {
|
|||||||
|
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
|
|
||||||
// if (status === "unauthenticated") router.push("/login");
|
|
||||||
|
|
||||||
// if (status === "authenticated") {
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
isError,
|
isError,
|
||||||
@@ -85,10 +81,17 @@ export default function UserProfile() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
if (status === "unauthenticated") router.push("/login");
|
||||||
return <LoadingPage />;
|
return <LoadingPage />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isError) {
|
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 <span>Error: {error.message}</span>;
|
return <span>Error: {error.message}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user