|
@@ -1,7 +1,7 @@
|
|
|
import storage from 'store'
|
|
|
import expirePlugin from 'store/plugins/expire'
|
|
|
import { login, getInfo, logout } from '@/api/login'
|
|
|
-import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
+import { ACCESS_TOKEN,Authorization } from '@/store/mutation-types'
|
|
|
import { welcome } from '@/utils/util'
|
|
|
|
|
|
storage.addPlugin(expirePlugin)
|
|
@@ -42,6 +42,7 @@ const user = {
|
|
|
const result = response.data
|
|
|
console.log(response)
|
|
|
storage.set(ACCESS_TOKEN, result.token, new Date().getTime() + 7 * 24 * 60 * 60 * 1000)
|
|
|
+ storage.set(Authorization, result.token)
|
|
|
commit('SET_TOKEN', result.token)
|
|
|
resolve()
|
|
|
}).catch(error => {
|
|
@@ -91,6 +92,7 @@ const user = {
|
|
|
commit('SET_TOKEN', '')
|
|
|
commit('SET_ROLES', [])
|
|
|
storage.remove(ACCESS_TOKEN)
|
|
|
+ storage.remove(Authorization)
|
|
|
resolve()
|
|
|
}).catch((err) => {
|
|
|
console.log('logout fail:', err)
|