chore: utils
This commit is contained in:
@@ -107,7 +107,7 @@ export class Request {
|
|||||||
this.uniq = !!uniq;
|
this.uniq = !!uniq;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.instance
|
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) => {
|
.then((res) => {
|
||||||
if (retRaw) {
|
if (retRaw) {
|
||||||
const data = res as T;
|
const data = res as T;
|
||||||
@@ -128,7 +128,7 @@ export class Request {
|
|||||||
this.uniq = !!uniq;
|
this.uniq = !!uniq;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.instance
|
this.instance
|
||||||
.put<Result<T>>(url, data, { ...reqConfig })
|
.put<Result<T>>(url, data, { ...reqConfig, signal: this.abortController.signal })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
resolve([null, res.data.data, res.data]);
|
resolve([null, res.data.data, res.data]);
|
||||||
})
|
})
|
||||||
@@ -143,7 +143,7 @@ export class Request {
|
|||||||
this.uniq = !!uniq;
|
this.uniq = !!uniq;
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
this.instance
|
this.instance
|
||||||
.delete<Result<T>>(url, { ...reqConfig, data: { ids: idList } })
|
.delete<Result<T>>(url, { ...reqConfig, data: { ids: idList }, signal: this.abortController.signal })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
resolve([null, res.data.data, res.data]);
|
resolve([null, res.data.data, res.data]);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user