ADD: added new auth middleware and changed the roles value ind the jwt token to a array
This commit is contained in:
@@ -9,7 +9,7 @@ const ViewEditPlayer = () => {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const token = localStorage.getItem('token');
|
||||
const currentUser = token ? getUserFromToken(token) : null;
|
||||
const isAdmin = currentUser?.role === 'admin';
|
||||
const isAdmin = currentUser?.role?.includes('admin');
|
||||
|
||||
const [player, setPlayer] = useState<User | null>(null);
|
||||
const [name, setName] = useState('');
|
||||
|
||||
Reference in New Issue
Block a user