Use token var instead of signedIn or user
This commit is contained in:
@@ -3,8 +3,8 @@ import { Redirect, Route } from 'react-router-dom';
|
||||
import { useUserContext } from '../Contexts/UserContext';
|
||||
|
||||
export const ProtectedRoute = ({ render, ...others }) => {
|
||||
const { user, setError } = useUserContext();
|
||||
if (!user || !user.sub || user.sub.length === 0) {
|
||||
const { token, setError } = useUserContext();
|
||||
if (!token) {
|
||||
setError('Please sign in to access');
|
||||
return <Redirect to="/" />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user