ADD: added new auth middleware and changed the roles value ind the jwt token to a array

This commit is contained in:
hwinkel
2025-11-23 22:55:04 +01:00
parent 139a99d96e
commit 3a6c3a86e3
9 changed files with 84 additions and 30 deletions

View File

@@ -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('');