diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index 6e1d0d9..8c58da4 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -1,11 +1,14 @@ import Menu from "@/components/menu"; +import { useAppContext } from "@/providers/AuthProvider"; import { FunctionComponent } from "preact"; import { lazy, Route, Router, useLocation } from "preact-iso"; import ids from "./profile.module.scss"; const ProfilePage: FunctionComponent = () => { const { route } = useLocation(); - return ( + const { isLoggedIn } = useAppContext(); + if (!isLoggedIn.value) route("/login", true); + return isLoggedIn.value ? (
@@ -25,6 +28,8 @@ const ProfilePage: FunctionComponent = () => {
+ ) : ( +

Redirecting...

); };