cf-wx-app/src/util/logout.js

28 lines
601 B
JavaScript
Raw Normal View History

2019-03-06 14:16:09 +08:00
import Taro from '@tarojs/taro'
import URL from '../serviceAPI.config'
2019-03-08 17:32:42 +08:00
import { getGlobalStorage } from './getSetStoage';
2019-03-06 14:16:09 +08:00
export default function logout() {
Taro.request({
url:URL.LogOut,
header: {
2019-03-08 17:32:42 +08:00
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
2019-03-06 14:16:09 +08:00
}
}).then(res=>{
Taro.showToast({
title:'退出成功'
})
Taro.clearStorageSync()
setTimeout(() => {
Taro.reLaunch({
url: '/pages/login/login'
})
}, 2000);
}).catch(err=>{
Taro.showToast({
title:'退出失败',
icon:'none'
})
Taro.clearStorageSync()
})
}