feat: check whether user has necessary scope
This commit is contained in:
@@ -2,9 +2,15 @@ import { FormEvent, useEffect, useState } from "react";
|
||||
import { apiAuth, loadPlayers, User } from "./api";
|
||||
import { useSession } from "./Session";
|
||||
import { ErrorState } from "./types";
|
||||
import { useNavigate } from "react-router";
|
||||
|
||||
const TeamPanel = () => {
|
||||
const { teams } = useSession();
|
||||
const { user, teams } = useSession();
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
user?.scopes.includes(`team:${teams?.activeTeam}`) ||
|
||||
navigate("/", { replace: true });
|
||||
}, [user]);
|
||||
const newPlayerTemplate = {
|
||||
id: 0,
|
||||
username: "",
|
||||
|
||||
Reference in New Issue
Block a user