Made user first and last name display on profile

This commit was merged in pull request #21.
This commit is contained in:
victorAnumudu
2023-01-31 11:02:18 +01:00
parent c336c66674
commit 7740adc7c5
5 changed files with 40 additions and 6 deletions
+4 -2
View File
@@ -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;