19 lines
466 B
TypeScript
19 lines
466 B
TypeScript
|
|
// apps/web/src/routes/guards/public-only-route.tsx
|
||
|
|
import type { ReactNode } from "react";
|
||
|
|
import { Navigate } from "react-router-dom";
|
||
|
|
|
||
|
|
interface PublicOnlyRouteProps {
|
||
|
|
children: ReactNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const PublicOnlyRouteGuard = ({ children }: PublicOnlyRouteProps) => {
|
||
|
|
// TODO: sustituir por tu estado real de auth.
|
||
|
|
const isAuthenticated = false;
|
||
|
|
|
||
|
|
if (isAuthenticated) {
|
||
|
|
return <Navigate replace to="/proformas" />;
|
||
|
|
}
|
||
|
|
|
||
|
|
return <>{children}</>;
|
||
|
|
};
|