|
|
@@ -19,7 +19,7 @@ export const myRequest = (options) => {
|
|
|
tenantId = await getTenantId();
|
|
|
uni.setStorageSync(host, tenantId);
|
|
|
}
|
|
|
- let token = uni.getStorageSync("token");
|
|
|
+ let token = uni.getStorageSync("seller_token");
|
|
|
uni.request({
|
|
|
url: BASE_URL + options.url,
|
|
|
method: options.method || "GET",
|
|
|
@@ -29,8 +29,7 @@ export const myRequest = (options) => {
|
|
|
TenantId: tenantId,
|
|
|
}
|
|
|
: {
|
|
|
- AuthorizationToken:
|
|
|
- "Bearer " + (token ? token : uni.getStorageSync("token_temp")),
|
|
|
+ AuthorizationToken: "Bearer " + token,
|
|
|
TenantId: tenantId,
|
|
|
},
|
|
|
success: async (res) => {
|
|
|
@@ -40,7 +39,7 @@ export const myRequest = (options) => {
|
|
|
}
|
|
|
if (res.data.code == 401) {
|
|
|
if (num <= 2) {
|
|
|
- if (!uni.getStorageSync("user_account")) {
|
|
|
+ if (!uni.getStorageSync("seller_account")) {
|
|
|
var pages = getCurrentPages(); // 获取栈实例
|
|
|
let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
|
|
|
if (currentRoute != "pages/login/login") {
|
|
|
@@ -53,7 +52,7 @@ export const myRequest = (options) => {
|
|
|
res = await doRequest(options);
|
|
|
}
|
|
|
} else {
|
|
|
- uni.removeStorageSync("user_account");
|
|
|
+ uni.removeStorageSync("seller_account");
|
|
|
var pages = getCurrentPages(); // 获取栈实例
|
|
|
let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
|
|
|
if (currentRoute != "pages/login/login") {
|
|
|
@@ -86,14 +85,14 @@ export const myRequest = (options) => {
|
|
|
});
|
|
|
});
|
|
|
async function doRequest(response) {
|
|
|
- let user_account = uni.getStorageSync("user_account");
|
|
|
+ let seller_account = uni.getStorageSync("seller_account");
|
|
|
try {
|
|
|
const res = await myRequest({
|
|
|
- url: "/app/common/seller/refreshToken/" + user_account,
|
|
|
+ url: "/app/common/seller/refreshToken/" + seller_account,
|
|
|
method: "get",
|
|
|
noToken: true,
|
|
|
});
|
|
|
- uni.setStorageSync("token", res.token);
|
|
|
+ uni.setStorageSync("seller_token", res.token);
|
|
|
num = 1;
|
|
|
store.dispatch("getUserInfo");
|
|
|
myRequest(response);
|