From db9132de4db2518fa294427e80bfa6e821959fa7 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Mon, 14 Apr 2025 21:10:04 +0300 Subject: [PATCH] feat: pseudo-auth --- src/pages/profile.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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...

); };