api ulandi

This commit is contained in:
Samandar Turgunboyev
2025-11-28 19:41:12 +05:00
parent c8f96f46ad
commit 83efa1f24a
35 changed files with 2043 additions and 767 deletions

20
src/LoginLayout.tsx Normal file
View File

@@ -0,0 +1,20 @@
import { getToken } from "@/shared/lib/cookie";
import { useEffect, type ReactNode } from "react";
import { useNavigate } from "react-router-dom";
const LoginLayout = ({ children }: { children: ReactNode }) => {
const token = getToken();
const navigate = useNavigate();
useEffect(() => {
if (!token) {
navigate("/");
} else if (token) {
navigate("/dashboard");
}
}, [token, navigate]);
return children;
};
export default LoginLayout;