feat: api client and natural login and logoff

This commit is contained in:
2025-05-05 16:53:18 +03:00
parent db73f498f6
commit 0055e09806
5 changed files with 215 additions and 26 deletions

View File

@@ -6,8 +6,16 @@ import ids from "./profile.module.scss";
const ProfilePage: FunctionComponent = () => {
const { route } = useLocation();
const { isLoggedIn } = useAppContext();
if (!isLoggedIn.value) route("/login", true);
const { isLoggedIn, isCheckingAuth } = useAppContext(); // Получаем новый сигнал
if (isCheckingAuth.value) {
return <div class="flex h-screen items-center justify-center">Проверка авторизации...</div>;
}
if (!isLoggedIn.value) {
route("/login", true);
return <p>Redirecting...</p>; // Заглушка на время редиректа
}
return isLoggedIn.value ? (
<div id={ids.main_container}>
<div id={ids.router_container}>