diff --git a/src/routes/ProtectedRoute.tsx b/src/routes/ProtectedRoute.tsx new file mode 100644 index 0000000..a3bed2c --- /dev/null +++ b/src/routes/ProtectedRoute.tsx @@ -0,0 +1,14 @@ +import { Navigate } from "react-router-dom" +import { useSelector } from "react-redux" +import { UserRootState } from "src/store/type" + + +export const ProtectedRoute = ({children}: any) => { + + const user = useSelector((state: UserRootState) => state.auth) + if(!user.is_admin) { + return ; + } + + return children; +} \ No newline at end of file