简化userInfo接口

This commit is contained in:
初志鑫 2020-07-28 16:57:27 +08:00
parent 0d2481def8
commit 5a25f7d169
2 changed files with 3 additions and 7 deletions

View File

@ -13,13 +13,10 @@ export async function login(data) {
});
}
export function getUserInfo(accessToken) {
export function getUserInfo() {
return request({
url: "/userInfo",
method: "post",
data: {
accessToken,
},
});
}

View File

@ -68,8 +68,8 @@ const actions = {
);
}
},
async getUserInfo({ commit, state }) {
const { data } = await getUserInfo(state.accessToken);
async getUserInfo({ commit }) {
const { data } = await getUserInfo();
if (!data) {
Vue.prototype.$baseMessage("验证失败,请重新登录...", "error");
return false;
@ -87,7 +87,6 @@ const actions = {
},
async logout({ dispatch }) {
await logout(state.accessToken);
await dispatch("tagsBar/delAllRoutes", null, { root: true });
await dispatch("resetAccessToken");
await resetRouter();
},