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 () {
this.formErrors = {}
this.saveAddress(this.userData)
.then(() => {
this.$emit('loaded')
})
.catch(error => {
this.alert({
message: 'Bitte überprüfe deine Eingaben.',
success: false,
})
error.response.then(data => {
const violations = data.violations
if (typeof violations !== 'undefined') {
for (let violation of violations) {
this.$set(this.formErrors, violation.property_path, violation.message)
}
const violations = error.violations
if (typeof violations !== 'undefined') {
for (let violation of violations) {
this.$set(this.formErrors, violation.property_path, violation.message)
}
})
}
})
.finally(() => {
this.$emit('loaded')
})
}
},
@@ -527,7 +527,6 @@
.then(() => this.loadServices())
.then(() => {
this.initialized = true;
this.$emit('loaded')
})
.catch(error => {
this.alert({
@@ -535,6 +534,9 @@
success: false,
})
})
.finally(() => {
this.$emit('loaded')
})
}
}
</script>
@@ -12,7 +12,11 @@ function checkStatus(response) {
return response
.json()
.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 Vuex from 'vuex'
import { checkStatus, handleError, defaultOptions } from '../api'
import { checkStatus, defaultOptions } from '../api'
const configElement = document.getElementById('appconfig')
const config = JSON.parse(configElement.innerHTML)
@@ -171,7 +171,12 @@ export default new Vuex.Store({
.then(checkStatus)
.then(response => response.json())
.then(response => response)
.catch(handleError)
.catch(error => {
commit('alert', {
message: 'Es ist ein Fehler aufgetreten: ' + error.message,
success: false,
})
})
.finally(() => {
commit('endLoading')
})
@@ -243,12 +248,6 @@ export default new Vuex.Store({
success: true,
})
})
.catch(error => {
commit('alert', {
message: 'Es ist ein Fehler aufgetreten: ' + error.message,
success: false,
})
})
.finally(() => {
commit('endLoading')
})