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

Commit

Permalink
Accept Merge Request #13: (feat-cookie-stage4 -> master)
Browse files Browse the repository at this point in the history
Merge Request: 优化cookie相关代码
Created By: @Alvin-Liu
Accepted By: @levy9527
URL: https://coding.net/u/shaowin/p/optimus-nuxt/git/merge/13
  • Loading branch information
levy9527 committed Mar 1, 2019
2 parents ce8c1d0 + 862e115 commit 2f4c424
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugins/axios.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Vue from 'vue'
import cookie from 'js-cookie'
import cookieKeys from '@/const/cookie-keys'

const path = process.env.COOKIE_PATH

export default function(context) {
let {$axios, store, app, redirect} = context
Expand Down Expand Up @@ -33,10 +36,9 @@ export default function(context) {
})

if (resp.status == 401) {
let path = process.env.COOKIE_PATH
cookie.remove('token', {path})
cookie.remove('userId', {path})
cookie.remove('tenantId', {path})
cookieKeys.forEach(key => {
cookie.remove(key, {path})
})
redirect('/login')
}
}
Expand Down

0 comments on commit 2f4c424

Please sign in to comment.