updated authentication on protected pages

This commit is contained in:
2023-06-05 12:00:28 +01:00
parent 3dd4525770
commit 31375a5999
20 changed files with 408 additions and 119 deletions
+12
View File
@@ -7,6 +7,7 @@ import Case from "../../components/case";
import CookieBanner from "../../components/cookieBanner";
import Footer from "../../components/footer";
import Header from "../../components/header";
import { useSession, getSession } from "next-auth/react";
const Home = (props) => {
const { footerLinks, pages } = props;
@@ -16,6 +17,17 @@ const Home = (props) => {
const { locale } = router;
const { appealtypes } = router.query;
const { data: session, status } = useSession();
if (status === "loading") {
return <NoSessionWarning loading={true} />;
}
if (status === "unauthenticated") {
router.push("/auth/signin");
return <NoSessionWarning />;
}
return (
<div>
<Head>