fix(gro-158): admin page blank — TypeError: b.filter is not a function #141

Merged
groombook-engineer[bot] merged 1 commits from fix/gro-158-admin-blank-filter into main 2026-03-28 02:53:20 +00:00
2 changed files with 14 additions and 4 deletions
+12 -3
View File
@@ -131,9 +131,18 @@ export function AppointmentsPage() {
setError(null);
Promise.all([
loadAppointments(),
fetch("/api/clients").then((r) => r.json() as Promise<Client[]>).then(setClients),
fetch("/api/services").then((r) => r.json() as Promise<Service[]>).then(setServices),
fetch("/api/staff").then((r) => r.json() as Promise<Staff[]>).then(setStaff),
fetch("/api/clients").then((r) => {
if (!r.ok) throw new Error(`HTTP ${r.status}`);
return r.json() as Promise<Client[]>;
}).then(setClients),
fetch("/api/services").then((r) => {
if (!r.ok) throw new Error(`HTTP ${r.status}`);
return r.json() as Promise<Service[]>;
}).then(setServices),
fetch("/api/staff").then((r) => {
if (!r.ok) throw new Error(`HTTP ${r.status}`);
return r.json() as Promise<Staff[]>;
}).then(setStaff),
])
.catch((e: unknown) => setError(e instanceof Error ? e.message : "Unknown error"))
.finally(() => setLoading(false));
+2 -1
View File
@@ -3,6 +3,7 @@ import { useNavigate } from "react-router-dom";
interface StaffUser {
id: string;
userId: string | null;
name: string;
email: string;
role: string;
@@ -66,7 +67,7 @@ export function DevLoginSelector() {
{staff.map((s) => (
<button
key={s.id}
onClick={() => selectUser("staff", s.id, s.name)}
onClick={() => selectUser("staff", s.userId ?? s.id, s.name)}
style={userButtonStyle}
>
<div style={{ fontWeight: 600, fontSize: 14 }}>{s.name}</div>