修改退出登录逻辑,新增访问接口退出
This commit is contained in:
parent
7ac104d1b8
commit
60fcd5f8e2
|
@ -1,6 +1,6 @@
|
|||
import { alertInfo } from "../../utils/index";
|
||||
import { alertInfo, alertSuccess } from "../../utils/index";
|
||||
import Dialog from '@vant/weapp/dialog/dialog';
|
||||
import { getUserInfo } from "../../service/user";
|
||||
import { getUserInfo, logout } from "../../service/user";
|
||||
import { getDot } from "../../utils/system";
|
||||
import request from "../../utils/request"
|
||||
const { OK } = request;
|
||||
|
@ -78,7 +78,12 @@ Page({
|
|||
dot
|
||||
})
|
||||
},
|
||||
logout() {
|
||||
async logout() {
|
||||
const { code, message } = await logout()
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
wx.clearStorageSync()
|
||||
wx.switchTab({
|
||||
url: '/pages/home/index',
|
||||
|
|
|
@ -54,4 +54,8 @@ export const getUserParksAndTenementsList = async function() {
|
|||
// 获取所有未阅读的用户数
|
||||
export const getUnReadApproveNumber = async function() {
|
||||
return await GET('/wx/getApproveNumber');
|
||||
}
|
||||
// 退出登录
|
||||
export const logout = async function() {
|
||||
return await POST('/wx/logout');
|
||||
}
|
|
@ -20,6 +20,7 @@ const requestWithoutCookie = promisify(wx.request);
|
|||
// 考虑了Cookie的请求
|
||||
const request = async function (options, config = {}) {
|
||||
console.log('请求参数', 'options', options, 'config', config)
|
||||
console.log('token', wx.getStorageSync('token'), 'user', wx.getStorageSync('user'))
|
||||
let token = wx.getStorageSync('token');
|
||||
const result = wx.getAccountInfoSync();
|
||||
const { envVersion } = result.miniProgram;
|
||||
|
|
Loading…
Reference in New Issue
Block a user