Update common file

This commit is contained in:
2023-11-30 10:37:50 +07:00
parent 28f15cec31
commit 5aec68dfce
13 changed files with 106 additions and 10 deletions
@@ -0,0 +1,15 @@
import { useAccount } from '@hook/authentication/useAccount';
import { ReactNode } from 'react';
import { Navigate } from 'react-router-dom';
interface IRouteProtected {
children: ReactNode;
}
const RouteProtected = ({ children }: IRouteProtected) => {
// Load user login
const { account } = useAccount();
return !account ? <Navigate to="/login" /> : children;
};
export default RouteProtected;