dedsudiyu 1 year ago
parent
commit
c231d172c3
2 changed files with 11 additions and 5 deletions
  1. 9 4
      src/store/modules/user.js
  2. 2 1
      src/utils/request.js

+ 9 - 4
src/store/modules/user.js

@@ -139,11 +139,16 @@ const user = {
     // 退出系统
     LogOut({ commit, state }) {
       return new Promise((resolve, reject) => {
+        debugger
+        commit('SET_TOKEN', '')
+        commit('SET_ROLES', [])
+        commit('SET_PERMISSIONS', [])
+        removeToken()
         logout(state.token).then(() => {
-          commit('SET_TOKEN', '')
-          commit('SET_ROLES', [])
-          commit('SET_PERMISSIONS', [])
-          removeToken()
+          // commit('SET_TOKEN', '')
+          // commit('SET_ROLES', [])
+          // commit('SET_PERMISSIONS', [])
+          // removeToken()
           resolve()
         }).catch(error => {
           reject(error)

+ 2 - 1
src/utils/request.js

@@ -92,8 +92,9 @@ service.interceptors.response.use(res => {
             type: 'warning'
           }
         ).then(() => {
+          localStorage.removeItem('serviceType');
           store.dispatch('LogOut').then(() => {
-            localStorage.removeItem('serviceType');
+            // localStorage.removeItem('serviceType');
             router.replace({
               path: '/login'
             })