fix: 登出清空了localStorage

This commit is contained in:
chenjianxing 2021-06-17 19:33:10 +08:00 committed by jianxing
parent fed363c6fb
commit 4bcfe27ac5
1 changed files with 3 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import {getCurrentUser} from "@/common/js/utils";
import AboutUs from "./AboutUs";
import axios from "axios";
import {mapGetters} from "vuex";
import {TokenKey} from "@/common/js/constants";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const auth = requireComponent.keys().length > 0 ? requireComponent("./auth/Auth.vue") : {};
@ -52,11 +53,11 @@ export default {
logout: function () {
axios.get("/signout").then(response => {
if (response.data.success) {
localStorage.clear();
localStorage.removeItem(TokenKey);
window.location.href = "/login";
}
}).catch(error => {
localStorage.clear();
localStorage.removeItem(TokenKey);
window.location.href = "/login";
});
},