fix(frontend): add data parameter support to apiDelete

- Add optional data parameter to apiDelete() with generic type safety
- Enables DELETE requests with request bodies (needed for folder deletion)
- 100% backward compatible (optional parameter)
- Supports type-safe request body passing

Part of: Issue 1
This commit is contained in:
2026-02-23 17:02:35 -05:00
parent 509423b46e
commit c333c82c6b
+5 -3
View File
@@ -34,12 +34,14 @@ async function apiPut(url: string, data?: unknown): Promise<Response> {
});
}
async function apiDelete(url: string): Promise<Response> {
async function apiDelete<T extends object>(url: string, data?: T): Promise<Response> {
return fetch(`/api${url}`, {
method: 'DELETE',
headers: {
'Authorization': getAuthHeader()
}
'Authorization': getAuthHeader(),
'Content-Type': 'application/json'
},
body: data ? JSON.stringify(data) : undefined
});
}