feat: Delete the files uploaded in the external dialog box #1880 (#1967)

### What problem does this PR solve?

feat: Delete the files uploaded in the external dialog box #1880

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-15 18:31:46 +08:00
committed by GitHub
parent d3ff1a30bf
commit 7bdd5a48c0
11 changed files with 111 additions and 33 deletions

View File

@ -41,6 +41,7 @@ export default {
get_document_list: `${api_host}/document/list`,
document_change_status: `${api_host}/document/change_status`,
document_rm: `${api_host}/document/rm`,
document_delete: `${api_host}/api/document`,
document_rename: `${api_host}/document/rename`,
document_create: `${api_host}/document/create`,
document_run: `${api_host}/document/run`,

View File

@ -6,6 +6,8 @@ type Service<T extends string> = Record<
(params?: any, urlAppendix?: string) => any
>;
const Methods = ['post', 'delete', 'put'];
const registerServer = <T extends string>(
opt: Record<T, { url: string; method: string }>,
request: RequestMethod,
@ -18,7 +20,7 @@ const registerServer = <T extends string>(
if (urlAppendix) {
url = url + '/' + urlAppendix;
}
if (opt[key].method === 'post' || opt[key].method === 'POST') {
if (Methods.some((x) => x === opt[key].method.toLowerCase())) {
return request(url, {
method: opt[key].method,
data: params,