fix:buildApi无数据情况下url多余?问题 (#5649)

This commit is contained in:
hsm-lv 2022-10-31 10:20:50 +08:00 committed by GitHub
parent a04e95c68c
commit 3a564380ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,7 +199,10 @@ export function buildApi(
api.url = api.url.substring(0, idx) + '?' + qsstringify(params);
} else {
api.query = data;
api.url += '?' + qsstringify(data);
const query = qsstringify(data);
if (query) {
api.url = `${api.url}?${query}`;
}
}
}
@ -213,7 +216,10 @@ export function buildApi(
api.url = api.url.substring(0, idx) + '?' + qsstringify(params);
} else {
api.query = api.data;
api.url += '?' + qsstringify(api.data);
const query = qsstringify(api.data);
if (query) {
api.url = `${api.url}?${query}`;
}
}
delete api.data;
}