feat: Initial setup of theme.
This commit is contained in:
19
src/routes/PrivateRoute.js
Normal file
19
src/routes/PrivateRoute.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import useAuthentication from 'hooks/useAuthentication';
|
||||
import React from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const PrivateRoute = ({ component }) => {
|
||||
const { isAuthenticated } = useAuthentication();
|
||||
if (isAuthenticated) {
|
||||
return <>{component} </>;
|
||||
}
|
||||
|
||||
return <Navigate to="/" />;
|
||||
};
|
||||
|
||||
PrivateRoute.propTypes = {
|
||||
component: PropTypes.any
|
||||
};
|
||||
|
||||
export default PrivateRoute;
|
||||
Reference in New Issue
Block a user