feat: api client and natural login and logoff
This commit is contained in:
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user