优化request.js
This commit is contained in:
parent
44909f038f
commit
fbd6124a80
|
@ -25,7 +25,7 @@ const request = async (args) => {
|
|||
throw "找不到API:" + args.api;
|
||||
}
|
||||
|
||||
if (rule.auth && !$store.state.user.token) {
|
||||
if (typeof rule.auth !== "undefined" && rule.auth === true && !$store.state.user.token) {
|
||||
$store.commit("user/showLoginModal", true);
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ const request = async (args) => {
|
|||
|
||||
const [error, response] = await uni.request({
|
||||
url: prototype.$config.root + rule.url,
|
||||
method: rule.method || 'get',
|
||||
method: rule.method || 'post',
|
||||
data: args.data,
|
||||
header: {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
|
|
Loading…
Reference in New Issue