Skip to content

Commit

Permalink
async修改
Browse files Browse the repository at this point in the history
  • Loading branch information
初志鑫 committed May 4, 2020
1 parent e47bffa commit 4762656
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/store/modules/tagsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,66 +89,66 @@ const actions = {
},
delView({ dispatch, state }, view) {
return new Promise(async (resolve) => {
dispatch("delVisitedView", view);
dispatch("delCachedView", view);
await dispatch("delVisitedView", view);
await dispatch("delCachedView", view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews],
});
});
},
delVisitedView({ commit, state }, view) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("DEL_VISITED_VIEW", view);
resolve([...state.visitedViews]);
});
},
delCachedView({ commit, state }, view) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("DEL_CACHED_VIEW", view);
resolve([...state.cachedViews]);
});
},
delOthersViews({ dispatch, state }, view) {
return new Promise(async (resolve) => {
dispatch("delOthersVisitedViews", view);
dispatch("delOthersCachedViews", view);
await dispatch("delOthersVisitedViews", view);
await dispatch("delOthersCachedViews", view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews],
});
});
},
delOthersVisitedViews({ commit, state }, view) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("DEL_OTHERS_VISITED_VIEWS", view);
resolve([...state.visitedViews]);
});
},
delOthersCachedViews({ commit, state }, view) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("DEL_OTHERS_CACHED_VIEWS", view);
resolve([...state.cachedViews]);
});
},
delAllViews({ dispatch, state }, view) {
return new Promise(async (resolve) => {
dispatch("delAllVisitedViews", view);
dispatch("delAllCachedViews", view);
await dispatch("delAllVisitedViews", view);
await dispatch("delAllCachedViews", view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews],
});
});
},
delAllVisitedViews({ commit, state }) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("DEL_ALL_VISITED_VIEWS");
resolve([...state.visitedViews]);
});
},
delAllCachedViews({ commit, state }) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("DEL_ALL_CACHED_VIEWS");
resolve([...state.cachedViews]);
});
Expand Down
8 changes: 4 additions & 4 deletions src/store/modules/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mutations = {
const actions = {
login({ commit }, userInfo) {
const { userName, password } = userInfo;
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
login({ userName, password })
.then((response) => {
const { accessToken } = response.data;
Expand Down Expand Up @@ -59,7 +59,7 @@ const actions = {
});
},
getInfo({ commit, state }) {
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
getInfo(state.accessToken)
.then((response) => {
const { data } = response;
Expand All @@ -80,7 +80,7 @@ const actions = {
});
},
logout({ commit, state, dispatch }) {
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
logout(state.accessToken)
.then(() => {
commit("SET_TOKEN", "");
Expand All @@ -96,7 +96,7 @@ const actions = {
});
},
resetToken({ commit }) {
return new Promise(async (resolve) => {
return new Promise((resolve) => {
commit("SET_TOKEN", "");
removeAccessToken();
resolve();
Expand Down

0 comments on commit 4762656

Please sign in to comment.