refactor(web): migrate playlists.ts to api.* wrapper (#375)

Drop 9 hand-rolled apiFetch calls with redundant Content-Type
headers + manual JSON.stringify. The api.* wrapper in client.ts
already handles both. Identical wire shape; existing tests cover
all endpoints.

Also makes api.del generic so DELETE endpoints with typed returns
(playlist track removal) can use the wrapper instead of raw
apiFetch. Default `T = null` preserves existing callers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-10 15:30:34 -04:00
co-authored by Claude Opus 4.7
parent 714039bae5
commit e8eff1baa1
2 changed files with 21 additions and 39 deletions
+2 -2
View File
@@ -58,6 +58,6 @@ export const api = {
apiFetch(path, { method: 'PUT', body: JSON.stringify(body) }) as Promise<T>,
patch: <T>(path: string, body: unknown): Promise<T> =>
apiFetch(path, { method: 'PATCH', body: JSON.stringify(body) }) as Promise<T>,
del: (path: string): Promise<null> =>
apiFetch(path, { method: 'DELETE' }) as Promise<null>
del: <T = null>(path: string): Promise<T> =>
apiFetch(path, { method: 'DELETE' }) as Promise<T>
};