chore: utils
This commit is contained in:
@@ -90,12 +90,11 @@ export class Request {
|
|||||||
this.instance
|
this.instance
|
||||||
.post(url, data, { ...reqConfig, headers: { 'content-type': upload ? 'multipart/form-data' : 'application/json' }, signal: this.abortController.signal })
|
.post(url, data, { ...reqConfig, headers: { 'content-type': upload ? 'multipart/form-data' : 'application/json' }, signal: this.abortController.signal })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
const resData = res.data;
|
||||||
if (retRaw) {
|
if (retRaw) {
|
||||||
const data = res as T;
|
resolve([null, resData as T, null]);
|
||||||
resolve([null, data, null]);
|
|
||||||
} else {
|
} else {
|
||||||
const resp = res as AxiosResponse<Result<T>>;
|
resolve([null, resData.data as T, resData as Result<T>]);
|
||||||
resolve([null, resp.data.data, resp.data]);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user