From 00fc4593d8f4ba04b81351e4d44ba68728d113fc Mon Sep 17 00:00:00 2001 From: Rykkel <220993G@mymail.nyp.edu.sg> Date: Mon, 29 Jul 2024 13:34:15 +0800 Subject: [PATCH] Access token verification --- client/src/pages/CommunityPage.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/client/src/pages/CommunityPage.tsx b/client/src/pages/CommunityPage.tsx index 7babcf0..fffe686 100644 --- a/client/src/pages/CommunityPage.tsx +++ b/client/src/pages/CommunityPage.tsx @@ -15,6 +15,7 @@ import { ModalBody, ModalFooter, useDisclosure, + Spinner, } from "@nextui-org/react"; import config from "../config"; import instance from "../security/http"; @@ -40,6 +41,24 @@ interface Post { export default function CommunityPage() { const navigate = useNavigate(); + + let accessToken = localStorage.getItem("accessToken"); + if (!accessToken) { + return ( + setTimeout(() => { + navigate("/signin"); + }, 1000) + && +
User is not verified
+Redirecting to sign-in page...
+