Made user first and last name display on profile
This commit was merged in pull request #21.
This commit is contained in:
@@ -2,10 +2,12 @@ import { Navigate, Outlet } from "react-router-dom";
|
||||
|
||||
const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||
const isLogin = localStorage.getItem("email");
|
||||
if (!isLogin) {
|
||||
const profile = localStorage.getItem("profile")
|
||||
|
||||
if (!isLogin || !profile || (typeof JSON.parse(profile) == 'object' && JSON.parse(profile).firstname == undefined)) {
|
||||
return <Navigate to={redirectPath} replace />;
|
||||
}
|
||||
return children || <Outlet />;
|
||||
};
|
||||
|
||||
export default AuthRoute;
|
||||
export default AuthRoute;
|
||||
Reference in New Issue
Block a user