chore: utils

This commit is contained in:
2025-08-12 16:17:18 +08:00
parent 83c5cebede
commit 42561b06de

View File

@@ -107,7 +107,7 @@ export class Request {
this.uniq = !!uniq;
return new Promise((resolve) => {
this.instance
.post(url, data, { ...reqConfig, headers: { 'content-type': upload ? 'multipart/form-data' : 'application/json' } })
.post(url, data, { ...reqConfig, headers: { 'content-type': upload ? 'multipart/form-data' : 'application/json' }, signal: this.abortController.signal })
.then((res) => {
if (retRaw) {
const data = res as T;
@@ -128,7 +128,7 @@ export class Request {
this.uniq = !!uniq;
return new Promise((resolve) => {
this.instance
.put<Result<T>>(url, data, { ...reqConfig })
.put<Result<T>>(url, data, { ...reqConfig, signal: this.abortController.signal })
.then((res) => {
resolve([null, res.data.data, res.data]);
})
@@ -143,7 +143,7 @@ export class Request {
this.uniq = !!uniq;
return new Promise((resolve) => {
this.instance
.delete<Result<T>>(url, { ...reqConfig, data: { ids: idList } })
.delete<Result<T>>(url, { ...reqConfig, data: { ids: idList }, signal: this.abortController.signal })
.then((res) => {
resolve([null, res.data.data, res.data]);
})