Merge branch 'develop'

This commit is contained in:
Björn Fromme
2022-12-07 19:08:54 +01:00
4 changed files with 23 additions and 20 deletions
@@ -106,22 +106,20 @@
save () { save () {
this.formErrors = {} this.formErrors = {}
this.saveAddress(this.userData) this.saveAddress(this.userData)
.then(() => {
this.$emit('loaded')
})
.catch(error => { .catch(error => {
this.alert({ this.alert({
message: 'Bitte überprüfe deine Eingaben.', message: 'Bitte überprüfe deine Eingaben.',
success: false, success: false,
}) })
error.response.then(data => { const violations = error.violations
const violations = data.violations if (typeof violations !== 'undefined') {
if (typeof violations !== 'undefined') { for (let violation of violations) {
for (let violation of violations) { this.$set(this.formErrors, violation.property_path, violation.message)
this.$set(this.formErrors, violation.property_path, violation.message)
}
} }
}) }
})
.finally(() => {
this.$emit('loaded')
}) })
} }
}, },
@@ -527,7 +527,6 @@
.then(() => this.loadServices()) .then(() => this.loadServices())
.then(() => { .then(() => {
this.initialized = true; this.initialized = true;
this.$emit('loaded')
}) })
.catch(error => { .catch(error => {
this.alert({ this.alert({
@@ -535,6 +534,9 @@
success: false, success: false,
}) })
}) })
.finally(() => {
this.$emit('loaded')
})
} }
} }
</script> </script>
@@ -12,7 +12,11 @@ function checkStatus(response) {
return response return response
.json() .json()
.then(error => { .then(error => {
throw Error(error.message) const responseError = new Error(error.message)
if (error.hasOwnProperty('violations')) {
responseError.violations = error.violations
}
throw responseError
}) })
} }
} }
@@ -1,6 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import { checkStatus, handleError, defaultOptions } from '../api' import { checkStatus, defaultOptions } from '../api'
const configElement = document.getElementById('appconfig') const configElement = document.getElementById('appconfig')
const config = JSON.parse(configElement.innerHTML) const config = JSON.parse(configElement.innerHTML)
@@ -171,7 +171,12 @@ export default new Vuex.Store({
.then(checkStatus) .then(checkStatus)
.then(response => response.json()) .then(response => response.json())
.then(response => response) .then(response => response)
.catch(handleError) .catch(error => {
commit('alert', {
message: 'Es ist ein Fehler aufgetreten: ' + error.message,
success: false,
})
})
.finally(() => { .finally(() => {
commit('endLoading') commit('endLoading')
}) })
@@ -243,12 +248,6 @@ export default new Vuex.Store({
success: true, success: true,
}) })
}) })
.catch(error => {
commit('alert', {
message: 'Es ist ein Fehler aufgetreten: ' + error.message,
success: false,
})
})
.finally(() => { .finally(() => {
commit('endLoading') commit('endLoading')
}) })