mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-28 03:10:55 +00:00
18 lines
412 B
TypeScript
18 lines
412 B
TypeScript
import { Navigate } from 'react-router-dom';
|
|
import type { ReactNode } from 'react';
|
|
import { authStorage } from '@ema-platform/auth';
|
|
|
|
interface ProfileGuardProps {
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function ProfileGuard({ children }: ProfileGuardProps) {
|
|
const profileId = authStorage.getProfileId();
|
|
|
|
if (!profileId) {
|
|
return <Navigate to="/profile-setup" replace />;
|
|
}
|
|
|
|
return <>{children}</>;
|
|
}
|