|
@@ -311,10 +311,7 @@ export const BaseService = serviceFactory({
|
|
|
},
|
|
},
|
|
|
loadData(options) {
|
|
loadData(options) {
|
|
|
const { progress } = this;
|
|
const { progress } = this;
|
|
|
- let { delay } = options;
|
|
|
|
|
- if (delay == null) {
|
|
|
|
|
- delay = this.delayTime;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const { delay = this.delayTime } = options;
|
|
|
let lastFetch = Promise.resolve();
|
|
let lastFetch = Promise.resolve();
|
|
|
if (delay) {
|
|
if (delay) {
|
|
|
lastFetch = this.lastFetch
|
|
lastFetch = this.lastFetch
|
|
@@ -325,17 +322,11 @@ export const BaseService = serviceFactory({
|
|
|
progress.total += 1;
|
|
progress.total += 1;
|
|
|
onStateChange();
|
|
onStateChange();
|
|
|
return lastFetch.then(() => {
|
|
return lastFetch.then(() => {
|
|
|
- let { prefix } = options;
|
|
|
|
|
- if (prefix == null) prefix = this.urlPrefix;
|
|
|
|
|
- const headers = Object.assign({}, this.headers, options.headers);
|
|
|
|
|
|
|
+ options = Object.assign({}, options);
|
|
|
|
|
+ options.headers = Object.assign({}, this.headers, options.headers);
|
|
|
let { url } = options;
|
|
let { url } = options;
|
|
|
- if (url.startsWith('/')) url = prefix + url;
|
|
|
|
|
- return request(url, {
|
|
|
|
|
- headers,
|
|
|
|
|
- method: options.method,
|
|
|
|
|
- body: options.body,
|
|
|
|
|
- responseType: options.responseType,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (url.startsWith('/')) url = (options.prefix ?? this.urlPrefix) + url;
|
|
|
|
|
+ return request(url, options);
|
|
|
})
|
|
})
|
|
|
.then(({ data }) => ({ data }), error => ({ error }))
|
|
.then(({ data }) => ({ data }), error => ({ error }))
|
|
|
.then(({ data, error }) => {
|
|
.then(({ data, error }) => {
|