PHP Classes

File: client/src/features/components/Routes/PrivateRoute.tsx

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Wallet API and Application   client/src/features/components/Routes/PrivateRoute.tsx   Download  
File: client/src/features/components/Routes/PrivateRoute.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Wallet API and Application
Application to manage a wallet by calling an API
Author: By
Last change:
Date: 2 years ago
Size: 401 bytes
 

Contents

Class file image Download
import { Navigate, useLocation } from 'react-router-dom'; import {useStore} from "../../../app/stores/store"; const PrivateRoute = ({ children }: { children: JSX.Element }) => { let location = useLocation(); const{userStore} = useStore() if (!userStore.isAdmin) { return <Navigate to="/" state={{ from: location }} />; } return children; }; export default PrivateRoute;