提交 1a5e1911 authored 作者: 王鹏飞's avatar 王鹏飞

fix: 修复退出登录的问题

上级 87538002
......@@ -37,6 +37,7 @@ App({
// 退出登录
logout() {
return api.logout().then(response => {
this.setToken('')
wx.removeStorageSync('token')
})
},
......@@ -52,6 +53,7 @@ App({
// 检查权限
async checkAccess(token) {
if (token) this.setToken(token)
if (!this.store.token) return false
try {
const user = await this.getUser({ check: true })
return !!user?.id
......
......@@ -18,11 +18,8 @@ const url_online = {
let config = url_online
/* 请求接口统一 重定义 */
const requestApi = obj => {
const token = wx.getStorageSync('token')
if (!token) {
wx.reLaunch({ url: '/pages/login/index' })
return
}
const app = getApp()
const token = app ? app.store.token : wx.getStorageSync('token')
wx.request({
url: obj.url,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论