import React from "react";
import { Link, Navigate } from "react-router-dom";
import { isAutheticated } from "../auth";
export const AdminAuth = ({ children, redirectTo }) => {
let auth = isAutheticated().user_Role;
return auth === "admin" ? children : <Navigate to={redirectTo} />;
};
i'm using react router dom to authenticate the user role but the user role is stored it in the localstorage and can be manipulated any time and my admin route be exposed. i'm securing my backend so they cannot access admin routes of my nodejs but they can access the admin route in reactjs..
my frontend ui is exposed to anyone who could modify their role on LOCAL STORAGE ?