diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue
index 196f4868..60de1b17 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Address.vue
@@ -62,13 +62,12 @@
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue
index 5d561e6f..d0d3ab09 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/App.vue
@@ -11,7 +11,7 @@
Buchungen
Teamer
- Logout
+ Logout
@@ -31,7 +31,7 @@
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue
index 0dbfa8da..33ba0e6c 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/BookingEdit.vue
@@ -171,8 +171,8 @@
import ServiceSelect from './components/ServiceSelect'
import ServicesOverview from './components/ServicesOverview'
import TransportationSelect from './components/TransportationSelect'
- import axios from 'axios'
- import {mapGetters, mapMutations, mapState} from 'vuex'
+ import { mapGetters, mapMutations, mapState } from 'vuex'
+ import { checkStatus, defaultOptions } from './api'
Vue.use(VueScrollTo)
@@ -222,78 +222,95 @@
},
methods: {
...mapMutations(['alert', 'beginLoading', 'endLoading']),
- loadFormOptions () {
- this.beginLoading();
- return axios({
- url: '/api/countries',
- }).then(response => {
- this.countries = response.data
- }).catch(error => {
- }).finally(() => {
- this.endLoading()
- });
- },
loadBookingData () {
this.beginLoading('Lade Reise- und Buchungsdaten...')
- return axios({
- url: `/api/booking/${this.bookingId}`
- }).then(response => {
- this.bookingData = response.data.bookingData;
- this.participantData = response.data.participantData;
- this.travelData = response.data.travelData;
- }).catch(() => {
- throw new Error('Reise- und Buchungsdaten konnten nicht geladen werden.');
- }).finally(() => {
- this.endLoading()
- })
+ const options = {
+ ...defaultOptions
+ }
+ return fetch(`${this.config.myEpApiBaseUrl}/api/booking/${this.bookingId}`, options)
+ .then(checkStatus)
+ .then(response => response.json())
+ .then(data => {
+ this.bookingData = data.bookingData
+ this.participantData = data.participantData
+ this.travelData = data.travelData
+ })
+ .catch(() => {})
+ .finally(() => {
+ this.endLoading()
+ })
},
loadEventData () {
this.beginLoading('Lade Vorgangsdaten...')
- return axios({
- url: `/api/event/${this.bookingData.bookingNumber}`
- }).then(response => {
- this.eventData = response.data;
- }).catch(error => {
- throw new Error(error.response.data.message);
- }).finally(() => {
- this.endLoading()
- })
+ const options = {
+ ...defaultOptions
+ }
+ return fetch(`${this.config.myEpApiBaseUrl}/api/event/${this.bookingData.bookingNumber}`, options)
+ .then(checkStatus)
+ .then(response => response.json())
+ .then(data => {
+ this.eventData = data
+ })
+ .catch(error => {
+ throw new Error(error.message)
+ })
+ .finally(() => {
+ this.endLoading()
+ })
},
loadMutableFields () {
this.beginLoading('Lade mögliche Änderungen...')
- return axios({
- url: `/api/mutable-fields/${this.travelData.busproId}`
- }).then(response => {
- this.mutableFields = response.data;
- }).catch(() => {
- throw new Error('Mögliche Änderungen konnten nicht geladen werden.');
- }).finally(() => {
- this.endLoading()
- })
+ const options = {
+ ...defaultOptions
+ }
+ return fetch(`${this.config.myEpApiBaseUrl}/api/mutable-fields/${this.travelData.busproId}`, options)
+ .then(checkStatus)
+ .then(response => response.json())
+ .then(data => {
+ this.mutableFields = data
+ })
+ .catch(() => {
+ throw new Error('Mögliche Änderungen konnten nicht geladen werden.');
+ })
+ .finally(() => {
+ this.endLoading()
+ })
},
loadContingents () {
this.beginLoading('Lade Kontingente...')
- return axios({
- url: `/api/contingents/${this.travelData.busproId}`
- }).then(response => {
- this.contingents = response.data;
- }).catch(() => {
- throw new Error('Kontingente konnten nicht geladen werden.');
- }).finally(() => {
- this.endLoading()
- })
+ const options = {
+ ...defaultOptions
+ }
+ return fetch(`${this.config.myEpApiBaseUrl}/api/contingents/${this.travelData.busproId}`, options)
+ .then(checkStatus)
+ .then(response => response.json())
+ .then(data => {
+ this.contingents = data
+ })
+ .catch(() => {
+ throw new Error('Kontingente konnten nicht geladen werden.');
+ })
+ .finally(() => {
+ this.endLoading()
+ })
},
loadServices () {
this.beginLoading('Lade Leistungen...')
- return axios({
- url: `/api/services/${this.travelData.busproId}`
- }).then(response => {
- this.services = response.data;
- }).catch(() => {
- throw new Error('Leistungen konnten nicht geladen werden.');
- }).finally(() => {
- this.endLoading()
- })
+ const options = {
+ ...defaultOptions
+ }
+ return fetch(`${this.config.myEpApiBaseUrl}/api/services/${this.travelData.busproId}`, options)
+ .then(checkStatus)
+ .then(response => response.json())
+ .then(data => {
+ this.services = data
+ })
+ .catch(() => {
+ throw new Error('Leistungen konnten nicht geladen werden.');
+ })
+ .finally(() => {
+ this.endLoading()
+ })
},
getAccommodationLabel (participant) {
if (participant.hasOwnProperty('accommodationId') && participant.accommodationId in this.contingents) {
@@ -423,32 +440,40 @@
return;
}
this.beginLoading()
- axios({
- url: `/api/booking/${this.bookingId}`,
- method: 'put',
- data: {
+ const options = {
+ ...defaultOptions,
+ method: 'PUT',
+ body: JSON.stringify({
participantData: this.participantData,
selectedTransportations: this.selectedTransportations,
remarks: this.bookingData.remarks,
- },
- }).then(response => {
- this.alert({
- message: response.data.message,
- success: true,
- });
- this.dirty = false;
- }).catch(error => {
- this.alert({
- message: error.response.data.message,
- success: false,
})
- }).finally(() => {
- this.endLoading()
- })
+ }
+ fetch(`${this.config.myEpApiBaseUrl}/api/booking/${this.bookingId}`, options)
+ .then(checkStatus)
+ .then(response => response.json())
+ .then(data => {
+ this.alert({
+ message: data.message,
+ success: true,
+ })
+ this.dirty = false
+ })
+ .catch(error => {
+ error.response.then(data => {
+ this.alert({
+ message: data.message,
+ success: false,
+ })
+ })
+ })
+ .finally(() => {
+ this.endLoading()
+ })
}
},
computed: {
- ...mapState(['loading']),
+ ...mapState(['config', 'loading']),
...mapGetters(['isGroupManager']),
availableContingents () {
let filteredContingents = {};
@@ -500,8 +525,7 @@
},
mounted () {
this.bookingId = this.$route.params.id
- this.loadFormOptions()
- .then(() => this.loadBookingData())
+ this.loadBookingData()
.then(() => this.loadEventData())
.then(() => this.loadMutableFields())
.then(() => this.loadContingents())
@@ -515,9 +539,6 @@
success: false,
});
})
- .finally(() => {
- this.endLoading()
- })
}
}
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue
index c5df36ef..7ee867fc 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/CrmData.vue
@@ -51,7 +51,7 @@
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue
index 1d07c175..0060bf52 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/Events.vue
@@ -75,10 +75,10 @@