ohif-viewer/platform/app/src/routes/PrivateRoute.tsx
Alireza 2bdf4afa4d
refactor(ui): Migrate components to ui-next (#4930)
Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
2025-04-08 12:06:07 -04:00

14 lines
302 B
TypeScript

import { useUserAuthentication } from '@ohif/ui-next';
export const PrivateRoute = ({ children, handleUnauthenticated }) => {
const [{ user, enabled }] = useUserAuthentication();
if (enabled && !user) {
return handleUnauthenticated();
}
return children;
};
export default PrivateRoute;