Sfoglia il codice sorgente

Move code to mutation methods

pull/12/head
Kristijan Mitrovic 4 anni fa
parent
commit
7510215806
1 ha cambiato i file con 10 aggiunte e 16 eliminazioni
  1. +10
    -16
      src/_store/account.module.js

+ 10
- 16
src/_store/account.module.js Vedi File

@@ -112,20 +112,11 @@ const actions = {
error => commit('logoutFailure', error)
);
},
restore({ dispatch, commit }, { shortKey, longKey, password, systemConfigs, messages, errors }) {
commit('restoreRequest');
systemConfigs.restoringInProgress = true;
restore({ commit }, { shortKey, longKey, password, systemConfigs, messages, errors }) {
commit('restoreRequest', systemConfigs);
userService.restore(shortKey, longKey, password, messages, errors)
.then(
ok => {
commit('restoreSuccess');
systemConfigs.awaitingRestore = false;
},
error => {
commit('restoreFailure', error);
systemConfigs.restoringInProgress = false;
}
);
.then(ok => commit('restoreSuccess', systemConfigs),
error => commit('restoreFailure', systemConfigs, error));
},
forgotPassword({ commit }, {username, messages, errors}) {
commit('forgotPasswordRequest');
@@ -309,14 +300,17 @@ const mutations = {
console.log('logout failed: '+JSON.stringify(error));
},

restoreRequest(state) {
restoreRequest(state, systemConfigs) {
state.status = Object.assign({}, state.status, {restoring: true});
systemConfigs.restoringInProgress = true;
},
restoreSuccess(state) {
restoreSuccess(state, systemConfigs) {
state.status = Object.assign({}, state.status, {restoring: false});
systemConfigs.awaitingRestore = false;
},
restoreFailure(state, error) {
restoreFailure(state, systemConfigs, error) {
state.status = Object.assign({}, state.status, {restoring: false});
systemConfigs.restoringInProgress = false;
console.log('restore failed: ' + JSON.stringify(error));
},



Caricamento…
Annulla
Salva