Fix incorrect error handling in some api calls
This commit is contained in:
@@ -171,7 +171,7 @@
|
|||||||
import ServicesOverview from './components/ServicesOverview'
|
import ServicesOverview from './components/ServicesOverview'
|
||||||
import TransportationSelect from './components/TransportationSelect'
|
import TransportationSelect from './components/TransportationSelect'
|
||||||
import { mapGetters, mapMutations, mapState } from 'vuex'
|
import { mapGetters, mapMutations, mapState } from 'vuex'
|
||||||
import { checkStatus, defaultOptions } from './api'
|
import {checkStatus, defaultOptions, handleError} from './api'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BookingEdit',
|
name: 'BookingEdit',
|
||||||
@@ -232,7 +232,7 @@
|
|||||||
this.participantData = data.participantData
|
this.participantData = data.participantData
|
||||||
this.travelData = data.travelData
|
this.travelData = data.travelData
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(handleError)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.endLoading()
|
this.endLoading()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function checkStatus(response) {
|
|||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response
|
return response
|
||||||
} else {
|
} else {
|
||||||
const error = new Error(response.status)
|
const error = new Error(response.statusText)
|
||||||
error.response = response.json()
|
error.response = response.json()
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,6 @@ function handleError() {
|
|||||||
message: 'Es ist ein Fehler aufgetreten :(',
|
message: 'Es ist ein Fehler aufgetreten :(',
|
||||||
success: false,
|
success: false,
|
||||||
})
|
})
|
||||||
throw error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { checkStatus, handleError, defaultOptions }
|
export { checkStatus, handleError, defaultOptions }
|
||||||
|
|||||||
Reference in New Issue
Block a user