-
-
-
-
-
@@ -56,12 +70,8 @@
export default {
data () {
return {
- userData: {
- email: '',
- name: '',
- firstName: '',
- gender: 'M'
- }
+ userData: {},
+ formErrors: {}
}
},
methods: {
@@ -70,51 +80,54 @@
this.register();
},
register () {
- if (!this.userData.email) {
- this.$store.commit('alert', {
- message: 'Bitte die E-Mail Adresse angeben',
- class: 'alert-danger'
- });
- return;
- }
- if (!this.userData.name) {
- this.$store.commit('alert', {
- message: 'Bitte den angeben',
- class: 'alert-danger'
- });
- return;
- }
- if (!this.userData.firstName) {
- this.$store.commit('alert', {
- message: 'Bitte den angeben',
- class: 'alert-danger'
- });
- return;
- }
+ this.initFormErrors();
this.$store.dispatch('register',
this.userData
- ).then((response) => {
- const result = response.data.satz;
- if (result.typ === 'HINWEIS') {
+ ).then(() => {
+ this.$store.dispatch('resetPassword', this.userData.email);
+ this.$store.commit('alert', {
+ message: 'Du erhältst in Kürze eine E-Mail mit einem Link zum (Zurück)setzen deines Passworts.',
+ class: 'alert-success'
+ });
+ this.initFormData();
+ this.initFormErrors();
+ }).catch(error => {
+ if (error.response.data['@type'] === 'hydra:Error') {
this.$store.commit('alert', {
message: 'Du bist bereits registriert. Bitte nutze die Passwort vergessen Funktion.',
class: 'alert-danger'
});
} else {
- this.$store.dispatch('resetPassword', this.userData.email);
- this.$store.commit('alert', {
- message: 'Du erhältst in Kürze eine E-Mail mit einem Link zum (Zurück)setzen deines Passworts.',
- class: 'alert-success'
- });
+ const violations = error.response.data['violations'];
+ for (let violation of violations) {
+ this.formErrors[violation.propertyPath] = violation.message;
+ }
}
- this.userData.email = '';
- this.userData.name = '';
- this.userData.firstName = '';
- }).then(() => {
+ }).finally(() => {
EventBus.$emit('scrollTo', '#myep-main');
});
+ },
+ initFormData () {
+ this.userData = {
+ name: '',
+ firstName: '',
+ email: '',
+ gender: 'M'
+ }
+ },
+ initFormErrors () {
+ this.formErrors = {
+ name: null,
+ firstName: null,
+ email: null,
+ gender: null
+ }
}
},
+ created () {
+ this.initFormData();
+ this.initFormErrors();
+ },
computed: {
loading () {
return this.$store.state.loading;
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Teamer.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Teamer.vue
index 93c97b0c..f70e7f36 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Teamer.vue
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/components/Teamer.vue
@@ -114,12 +114,13 @@
this.$store.dispatch('teamer/load')
.then((data) => {
this.teamerData = data;
+ }).finally(() => {
EventBus.$emit('scrollTo', '#myep-main');
- })
+ });
},
saveTeamerData () {
this.$store.dispatch('teamer/save', this.teamerData)
- .then(() => {
+ .finally(() => {
EventBus.$emit('scrollTo', '#myep-main');
});
}
diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/stores/address.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/stores/address.js
index ec25bd3e..3ca0b8f7 100644
--- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/stores/address.js
+++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/myep/stores/address.js
@@ -52,8 +52,6 @@ export default {
message: 'Es ist ein Fehler aufgetreten :(',
class: 'alert-danger'
}, { root: true });
- commit('logout', null, { root: true });
- EventBus.$emit('forcedLogout');
throw error;
});
}