Commit 778cb2ae authored by janis.streib's avatar janis.streib 🦉
Browse files

FIX: converted executeTransaction from mutation to action

parent cafdb8c4
......@@ -97,7 +97,7 @@
</b-button>
<b-button
:disabled="$store.state.ta_list == null || $store.state.ta_list.length === 0 || $store.state.executing_transaction"
variant="success" @click="$store.commit('executeTransaction')">
variant="success" @click="executeTa">
<font-awesome-icon :icon="['far', 'paper-plane']"/>
Anwenden
</b-button>
......@@ -174,6 +174,9 @@ export default {
},
move(from, to) {
this.$store.state.ta_list.move(from, to);
},
async executeTa() {
await this.$store.dispatch('executeTransaction')
}
},
data() {
......
......@@ -186,8 +186,22 @@ const store = new Vuex.Store({
window.localStorage.setItem('transaction_result', JSON.stringify(state.transaction_result))
}
},
async executeTransaction(state) {
this.commit('setTransactionBusy', true)
showSidebar(state, show) {
state.show_sidebar = show
window.localStorage.setItem('show_sidebar', show)
},
setTransactionBusy(state, busy) {
state.executing_transaction = busy
window.localStorage.setItem('executing_transaction', busy)
},
removeTransactionResult(state) {
state.transaction_result = null
window.localStorage.removeItem('transaction_result')
}
},
actions: {
async executeTransaction({commit, state}) {
commit('setTransactionBusy', true)
let api_list = APIUtil.buildAPITaFromTaObjectArray(state.ta_list)
try {
......@@ -204,7 +218,6 @@ const store = new Vuex.Store({
state.transaction_result = {
'type': 'success'
}
this.$router.go()
} catch (e) {
window.console.debug(e.response)
state.transaction_result = {
......@@ -213,22 +226,10 @@ const store = new Vuex.Store({
'uuid': state.ta_list[APIUtil.getAPIErrorIndexFromDBException(e.response.data.exception)].uuid
}
} finally {
this.commit('setTransactionBusy', false)
commit('setTransactionBusy', false)
window.localStorage.setItem('transaction_result', JSON.stringify(state.transaction_result))
}
},
showSidebar(state, show) {
state.show_sidebar = show
window.localStorage.setItem('show_sidebar', show)
},
setTransactionBusy(state, busy) {
state.executing_transaction = busy
window.localStorage.setItem('executing_transaction', busy)
},
removeTransactionResult(state) {
state.transaction_result = null
window.localStorage.removeItem('transaction_result')
}
},
plugins: [
sharedMutations(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment