completionId: cgen-3928ed43522a40d297f76eef9d24042d
cgen-3928ed43522a40d297f76eef9d24042d
This commit is contained in:
parent
2cf571991f
commit
275d17a836
1 changed files with 10 additions and 11 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue