Skip to content
This repository was archived by the owner on Jul 18, 2019. It is now read-only.

Commit 2f4c424

Browse files
author
levy9527
committed
Accept Merge Request #13: (feat-cookie-stage4 -> master)
Merge Request: 优化cookie相关代码 Created By: @Alvin-Liu Accepted By: @levy9527 URL: https://coding.net/u/shaowin/p/optimus-nuxt/git/merge/13
2 parents ce8c1d0 + 862e115 commit 2f4c424

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/plugins/axios.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import Vue from 'vue'
22
import cookie from 'js-cookie'
3+
import cookieKeys from '@/const/cookie-keys'
4+
5+
const path = process.env.COOKIE_PATH
36

47
export default function(context) {
58
let {$axios, store, app, redirect} = context
@@ -33,10 +36,9 @@ export default function(context) {
3336
})
3437

3538
if (resp.status == 401) {
36-
let path = process.env.COOKIE_PATH
37-
cookie.remove('token', {path})
38-
cookie.remove('userId', {path})
39-
cookie.remove('tenantId', {path})
39+
cookieKeys.forEach(key => {
40+
cookie.remove(key, {path})
41+
})
4042
redirect('/login')
4143
}
4244
}

0 commit comments

Comments
 (0)