feat: add abort upload controller as function args
This commit is contained in:
parent
f5626f9f2e
commit
f899e909f0
1 changed files with 2 additions and 0 deletions
|
|
@ -289,6 +289,7 @@ export function manageAttachment(
|
||||||
name: string;
|
name: string;
|
||||||
file: File;
|
file: File;
|
||||||
onUploadProgress?: (e: AxiosProgressEvent) => void;
|
onUploadProgress?: (e: AxiosProgressEvent) => void;
|
||||||
|
abortController?: AbortController;
|
||||||
}) => {
|
}) => {
|
||||||
const res = await api.put(
|
const res = await api.put(
|
||||||
`/${base}/${opts.parentId}/attachment/${opts.name}`,
|
`/${base}/${opts.parentId}/attachment/${opts.name}`,
|
||||||
|
|
@ -300,6 +301,7 @@ export function manageAttachment(
|
||||||
: option?.onUploadProgress
|
: option?.onUploadProgress
|
||||||
? option.onUploadProgress
|
? option.onUploadProgress
|
||||||
: (e) => console.log(e),
|
: (e) => console.log(e),
|
||||||
|
signal: opts.abortController?.signal,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.status < 400) return true;
|
if (res.status < 400) return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue