|
|
@@ -85,7 +85,7 @@ const actions = { |
|
|
|
// get user info |
|
|
|
getInfo({ commit, state }) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
api.getInfo({token:Cookies.get('token')}).then(res => { |
|
|
|
api.getInfo({token:Cookies.get(location.host+'-token')}).then(res => { |
|
|
|
commit('SET_INFO', res.data.info?res.data.info:{}) |
|
|
|
commit('SET_PERMISSION', res.data.permission?res.data.permission:[]) |
|
|
|
if(res.data.permission.length>0){ |
|
|
@@ -97,7 +97,7 @@ const actions = { |
|
|
|
} |
|
|
|
resolve(res.data.info) |
|
|
|
}).catch(e => { |
|
|
|
Cookies.set('token','') |
|
|
|
Cookies.set(location.host+'-token','') |
|
|
|
commit('SET_INFO', null) |
|
|
|
commit('SET_MENU', []) |
|
|
|
commit('SET_ROLES', null) |
|
|
@@ -112,8 +112,8 @@ const actions = { |
|
|
|
// user logout |
|
|
|
logout({ commit, state }) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
api.logout(Cookies.get('token')).then(res => { |
|
|
|
Cookies.set('token','') |
|
|
|
api.logout(Cookies.get(location.host+'-token')).then(res => { |
|
|
|
Cookies.set(location.host+'-token','') |
|
|
|
commit('SET_INFO', null) |
|
|
|
commit('SET_MENU', []) |
|
|
|
commit('SET_ROLES', null) |
|
|
@@ -129,7 +129,7 @@ const actions = { |
|
|
|
// remove token |
|
|
|
resetToken({ commit }) { |
|
|
|
return new Promise(resolve => { |
|
|
|
Cookies.set('token','') |
|
|
|
Cookies.set(location.host+'-token','') |
|
|
|
commit('SET_INFO', null) |
|
|
|
commit('SET_MENU', []) |
|
|
|
commit('SET_ROLES', null) |