completionId: cgen-3928ed43522a40d297f76eef9d24042d

cgen-3928ed43522a40d297f76eef9d24042d
This commit is contained in:
Builder.io 2025-11-11 02:14:26 +00:00
parent 2cf571991f
commit 275d17a836

View file

@ -69,21 +69,20 @@ export default function AdminStaffDirectory() {
const handleSeedData = async () => {
try {
setIsSeeding(true);
const response = await fetch("/api/staff/members/seed", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
// Read response body once
const result = await response.json();
const response = await fetch("/api/staff/members/seed");
if (!response.ok) {
throw new Error(result.details || result.error || "Failed to seed data");
throw new Error("Failed to seed data: " + response.statusText);
}
// Read response body as text first to avoid stream issues
const text = await response.text();
if (!text) {
throw new Error("No response from server");
}
const result = JSON.parse(text);
setTeamMembers(result.members || []);
aethexToast.success({