fix: RequireAuth no fallback UI, client-only check

This commit is contained in:
Tracewebstudio Dev 2026-04-21 23:58:09 +02:00
parent 1990b5c99d
commit 87a741540b

View file

@ -148,15 +148,14 @@ export function useAuth() {
return ctx;
}
export function RequireAuth(props: ParentProps<{ fallback?: string }>) {
export function RequireAuth(props: ParentProps) {
const navigate = useNavigate();
const auth = useAuth();
const fallback = props.fallback || '/login';
createEffect(() => {
if (typeof window === 'undefined') return;
if (!auth.isAuthenticated()) {
navigate(fallback, { replace: true });
navigate('/login', { replace: true });
}
});