fix:delete ticket ui

This commit is contained in:
2026-03-14 02:56:05 +09:00
parent d14c4b5258
commit 41f38c671b
2 changed files with 6974 additions and 1 deletions

View File

@@ -16,10 +16,14 @@ export class ApiError extends Error {
} }
async function apiFetch<T>(path: string, init: RequestInit = {}): Promise<T> { async function apiFetch<T>(path: string, init: RequestInit = {}): Promise<T> {
const hasBody = init.body != null;
const res = await fetch(`${API}${path}`, { const res = await fetch(`${API}${path}`, {
...init, ...init,
credentials: "include", credentials: "include",
headers: { "Content-Type": "application/json", ...(init.headers ?? {}) }, headers: {
...(hasBody ? { "Content-Type": "application/json" } : {}),
...(init.headers ?? {}),
},
}); });
if (!res.ok) { if (!res.ok) {
// Try to parse a structured error body; fall back to a generic message // Try to parse a structured error body; fall back to a generic message
@@ -34,6 +38,9 @@ async function apiFetch<T>(path: string, init: RequestInit = {}): Promise<T> {
} }
throw new ApiError(res.status, code, message); throw new ApiError(res.status, code, message);
} }
// delete
if (res.status === 204) return undefined as T;
return res.json(); return res.json();
} }

6966
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff