基础优化

This commit is contained in:
Chen committed 2025-12-07 11:37:00 +08:00
1 parent b606190e0c
commit 6394ac16a2
14 files changed
+457 -177

No files matched your search

+12 -2
View File
@@ -137,9 +137,19 @@ function patch(url, body, options = {}) {
/**
* DELETE 请求
* 支持带 body 的 DELETE 请求(用于批量删除等操作)
*/
function del(url, options = {}) {
return request(url, { method: 'DELETE', ...options });
function del(url, body, options = {}) {
// 如果 body 是对象(非 options),则作为请求体发送
if (body && typeof body === 'object' && !body.method) {
return request(url, {
method: 'DELETE',
body: JSON.stringify(body),
...options
});
}
// 否则,body 实际上是 options
return request(url, { method: 'DELETE', ...body });
}
export const api = {
+1 -4
View File
@@ -14,10 +14,7 @@ export const fileAPI = {
* @param {Array} items - 待删除项 [{type: 'file'|'folder', path: 'path'}]
*/
async delete(libraryId, items) {
return api.delete('/file/delete', {
body: JSON.stringify({ libraryId, items }),
headers: { 'Content-Type': 'application/json' }
});
return api.delete('/file/delete', { libraryId, items });
},
/**