feat: check whether user has necessary scope
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
} from "reagraph";
|
||||
import { customTheme } from "./NetworkTheme";
|
||||
import { useSession } from "./Session";
|
||||
import { useNavigate } from "react-router";
|
||||
|
||||
interface NetworkData {
|
||||
nodes: GraphNode[];
|
||||
@@ -45,7 +46,12 @@ export const GraphComponent = () => {
|
||||
const [likes, setLikes] = useState(2);
|
||||
const [popularity, setPopularity] = useState(false);
|
||||
const [mutuality, setMutuality] = useState(false);
|
||||
const { teams } = useSession();
|
||||
const { user, teams } = useSession();
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
user?.scopes.includes(`team:${teams?.activeTeam}`) ||
|
||||
navigate("/", { replace: true });
|
||||
}, [user]);
|
||||
|
||||
async function loadData() {
|
||||
setLoading(true);
|
||||
|
Reference in New Issue
Block a user