We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f9e69c commit 4f3e458Copy full SHA for 4f3e458
src/store/modules/user.js
@@ -1,8 +1,10 @@
1
import storage from 'store'
2
+import expirePlugin from 'store/plugins/expire'
3
import { login, getInfo, logout } from '@/api/login'
4
import { ACCESS_TOKEN } from '@/store/mutation-types'
5
import { welcome } from '@/utils/util'
6
7
+storage.addPlugin(expirePlugin)
8
const user = {
9
state: {
10
token: '',
@@ -38,7 +40,7 @@ const user = {
38
40
return new Promise((resolve, reject) => {
39
41
login(userInfo).then(response => {
42
const result = response.result
- storage.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
43
+ storage.set(ACCESS_TOKEN, result.token, new Date().getTime() + 7 * 24 * 60 * 60 * 1000)
44
commit('SET_TOKEN', result.token)
45
resolve()
46
}).catch(error => {
0 commit comments