diff --git a/apps/web/src/pages/Staff.tsx b/apps/web/src/pages/Staff.tsx
index a521e1c..f338338 100644
--- a/apps/web/src/pages/Staff.tsx
+++ b/apps/web/src/pages/Staff.tsx
@@ -75,8 +75,19 @@ export function StaffPage() {
}
async function toggleActive(s: Staff) {
- await fetch(`/api/staff/${s.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ active: !s.active }) });
- await load();
+ setTogglingId(s.id);
+ setToggleError(null);
+ try {
+ const res = await fetch(`/api/staff/${s.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ active: !s.active }) });
+ if (!res.ok) {
+ const err = (await res.json()) as { error?: string };
+ setToggleError(err.error ?? `HTTP ${res.status}`);
+ return;
+ }
+ await load();
+ } finally {
+ setTogglingId(null);
+ }
}
async function toggleSuperUser(s: Staff) {
@@ -137,34 +148,83 @@ export function StaffPage() {
{s.email} |
{s.role} |
- {s.isSuperUser ? (
-
- Super User
-
+ {currentUser?.isSuperUser ? (
+
) : (
- —
+ s.isSuperUser ? (
+ Super User
+ ) : (
+ —
+ )
)}
|
-
- {s.active ? "Active" : "Inactive"}
-
+
|
- {currentUser?.isSuperUser && (
- <>
-
- >
- )}
-
-
+
|
))}