mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Refactor state
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { useAppState } from "./chat/state";
|
||||
import { useUserStore } from "@/state/user";
|
||||
import { Navigate } from "react-router-dom";
|
||||
|
||||
interface ProtectedRouteProps {
|
||||
@@ -7,7 +7,7 @@ interface ProtectedRouteProps {
|
||||
}
|
||||
|
||||
export default function ProtectedRoute({ children }: ProtectedRouteProps) {
|
||||
const { user } = useAppState();
|
||||
const { user } = useUserStore();
|
||||
|
||||
return !user.authToken ? <Navigate to="/login" /> : children;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user