fix: 登出清空了localStorage

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

View File

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