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
+14
View File
@@ -9,6 +9,7 @@ import Header from "../../components/header";
import Aboutyou from "../../components/newappeal/aboutyou";
import CreateCase from "../../components/newappeal/createCase";
import { wrapper } from "../../store/store";
import { getSession, useSession } from "next-auth/react";
const AboutYou = (props) => {
const { footerLinks, pages, formData } = props;
@@ -118,6 +119,19 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log(cookies);
let loggedInUser = cookies.pinsUser;
let thisSession = await getSession(ctx);
//console.log("nextAuth Session:", thisSession);
if (!thisSession) {
console.log("not has sesssion.......");
return {
redirect: {
destination: "/auth/signin",
permanent: false,
},
};
}
}
);