mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-04-28 06:49:32 +07:00
23 lines
412 B
TypeScript
23 lines
412 B
TypeScript
import { useAuth } from "@/hooks/useAuth";
|
|
import { Navigate, Outlet } from "react-router-dom";
|
|
|
|
const AuthLayout = () => {
|
|
const auth = useAuth();
|
|
|
|
if (auth.isLoading) {
|
|
return null;
|
|
}
|
|
|
|
if (auth.isAuthenticated) {
|
|
return <Navigate to="/" replace />;
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-svh flex items-center justify-center">
|
|
<Outlet />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default AuthLayout;
|