feat: update transfers

This commit is contained in:
2025-12-07 19:36:49 +03:00
parent 79539d0583
commit 7e068e49f5
12 changed files with 407 additions and 63 deletions

View File

@@ -51,7 +51,9 @@ import {
const PublicRoute = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated } = authStore;
if (isAuthenticated) {
const need_auth = import.meta.env.VITE_NEED_AUTH == "true";
if (isAuthenticated || !need_auth) {
return <Navigate to="/map" replace />;
}
return <>{children}</>;
@@ -59,13 +61,18 @@ const PublicRoute = ({ children }: { children: React.ReactNode }) => {
const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated } = authStore;
const need_auth = import.meta.env.VITE_NEED_AUTH == "true";
const location = useLocation();
if (!isAuthenticated) {
if (!isAuthenticated && need_auth) {
return <Navigate to="/login" replace />;
}
if (location.pathname === "/") {
return <Navigate to="/map" replace />;
}
return <>{children}</>;
};