Separate Client Portal & Dashboard
This commit is contained in:
22
frontend/dashboard/src/guards/GuestGuard.tsx
Normal file
22
frontend/dashboard/src/guards/GuestGuard.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
// hooks
|
||||
import useAuth from '../hooks/useAuth';
|
||||
// routes
|
||||
// import { PATH_DASHBOARD } from '../routes/paths';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type GuestGuardProps = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
export default function GuestGuard({ children }: GuestGuardProps) {
|
||||
const { isAuthenticated } = useAuth();
|
||||
|
||||
if (isAuthenticated) {
|
||||
return <Navigate to={'/dashboard'} />;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
Reference in New Issue
Block a user