修复request.js的bug

This commit is contained in:
TOP糯米 2023-03-07 09:13:37 +08:00
parent 934252e2d1
commit b8274529c2
1 changed files with 4 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import $store from "@/store/index";
import Vue from "vue"
let prototype = Vue.prototype;
@ -24,14 +25,14 @@ const request = async (args) => {
throw "找不到API" + args.api;
}
if (rule.auth && !prototype.$store.state.user.token) {
prototype.$store.commit("user/showLoginModal", true);
if (rule.auth && !$store.state.user.token) {
$store.commit("user/showLoginModal", true);
return;
}
const headers = {
"XX-Wxapp-AppId": prototype.$config.appId,
'XX-Token': prototype.$store.state.user.token,
'XX-Token': $store.state.user.token,
'XX-Device-Type': 'wxapp',
};