updated authentication on protected pages
This commit is contained in:
@@ -28,6 +28,9 @@ import {
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import NoSessionWarning from "../../components/nosession";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, formData } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
@@ -39,6 +42,17 @@ const Home = (props) => {
|
||||
const { appealType, LPAData } = props;
|
||||
const [passwordUpdated, setPasswordUpdated] = useState(false);
|
||||
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
if (status === "loading") {
|
||||
return <NoSessionWarning loading={true} />;
|
||||
}
|
||||
|
||||
if (status === "unauthenticated") {
|
||||
router.push("/auth/signin");
|
||||
return <NoSessionWarning />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
|
||||
Reference in New Issue
Block a user