updated authentication on protected pages
This commit is contained in:
@@ -28,6 +28,8 @@ import {
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
import NoSessionWarning from "../../components/nosession";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
@@ -62,6 +64,17 @@ const Home = (props) => {
|
||||
updateAccountStore();
|
||||
}, [dispatch]);
|
||||
|
||||
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