feat: add abort upload controller as function args

This commit is contained in:
Methapon Metanipat 2024-10-22 15:02:18 +07:00
parent f5626f9f2e
commit f899e909f0

View file

@ -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;