This commit is contained in:
parent
fe5b3ec15b
commit
81afd2965e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/query",
|
"name": "@kevisual/query",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -64,6 +64,7 @@ export class Query<U = any, V = any> {
|
|||||||
const headers = { ...this.headers, ...options?.headers };
|
const headers = { ...this.headers, ...options?.headers };
|
||||||
const adapter = options?.adapter || this.adapter;
|
const adapter = options?.adapter || this.adapter;
|
||||||
const beforeRequest = options?.beforeRequest || this.beforeRequest;
|
const beforeRequest = options?.beforeRequest || this.beforeRequest;
|
||||||
|
const afterResponse = options?.afterResponse || this.afterResponse;
|
||||||
const timeout = options?.timeout || this.timeout;
|
const timeout = options?.timeout || this.timeout;
|
||||||
const req = {
|
const req = {
|
||||||
url: url,
|
url: url,
|
||||||
@ -76,8 +77,8 @@ export class Query<U = any, V = any> {
|
|||||||
}
|
}
|
||||||
return adapter(req).then(async (res) => {
|
return adapter(req).then(async (res) => {
|
||||||
res.success = res.code === 200;
|
res.success = res.code === 200;
|
||||||
if (options?.afterResponse) {
|
if (afterResponse) {
|
||||||
return await options.afterResponse(res);
|
return await afterResponse(res);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user