Browse Source

cookie设置修改

yangc 7 years ago
parent
commit
c4d4fee992
1 changed files with 8 additions and 10 deletions
  1. 8 10
      store/index.js

+ 8 - 10
store/index.js

@@ -39,16 +39,14 @@ export const actions = {
       store.commit('option/GET_MESSAGETYPE', messageType)
     }
     if (cookie && cookie.length) {
-      if (cookie) {
-        for (let i = 0; i < cookie.length; i++) {
-          if (cookie[i].indexOf('JSESSIONID') > -1) {
-            const sessionId = cookie[i]
-            const first = sessionId.indexOf(';')
-            const second = sessionId.lastIndexOf(';')
-            const newSessionId = sessionId.replace(sessionId.substring(first, second), '')
-            store.commit('option/SET_SESSION_ID', newSessionId)
-            break
-          }
+      for (let i = 0; i < cookie.length; i++) {
+        if (cookie[i].indexOf('JSESSIONID') > -1) {
+          const sessionId = cookie[i]
+          const first = sessionId.indexOf(';')
+          const second = sessionId.lastIndexOf(';')
+          const newSessionId = sessionId.replace(sessionId.substring(first, second), '')
+          store.commit('option/SET_SESSION_ID', newSessionId)
+          break
         }
       }
       axios.defaults.headers['cookie'] = store.state.option.cookies + '; ' + store.state.option.sessionId