Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion client/src/components/controlpanel/CampusSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "./ControlPanel.css";
import { useRef, useState } from "react";
import { useRef, useState, useEffect } from "react";
import { Link } from "react-router-dom";
import {
Breadcrumb,
Expand All @@ -15,6 +15,16 @@ import { useTypedSelector } from "../../state/hooks";
const CampusSettings = () => {
//Global state
const org = useTypedSelector((state) => state.org);
const user = useTypedSelector((state) => state.user);

useEffect(() => {
if (!user || !user.uuid) { // Ensure user is loaded before checking roles
return;
}
if (!user.isCampusAdmin && !user.isSuperAdmin && !user.isSupport) {
window.location.href = "/home";
}
}, [user]);

const settingsFormRef =
useRef<React.ElementRef<typeof CampusSettingsForm>>(null);
Expand Down
Loading