diff --git a/src/plugins/axios.js b/src/plugins/axios.js index d57c238..6da1e85 100755 --- a/src/plugins/axios.js +++ b/src/plugins/axios.js @@ -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 @@ -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') } }