Fix: Make registration functional in MyE&P after changes in store api

This commit is contained in:
Björn Fromme
2023-03-09 13:39:33 +01:00
parent 6d5246c3aa
commit 49030ba5a7
2 changed files with 10 additions and 8 deletions
@@ -3,7 +3,7 @@
<h1 class="mb-4">
Registrierung MyE&amp;P
</h1>
<form @submit.prevent="register()">
<form @submit.prevent="performRegistration()">
<div class="grid grid-cols-1 md:grid-cols-2 gap-x-4 mb-4">
<form-group label="Vorname" :error="formErrors.firstName">
<input type="text" v-model="userData.firstName" class="border-zinc-400 focus:border-zinc-800 ring-0 focus:ring-0 mt-1 w-full">
@@ -33,9 +33,9 @@
</form>
</div>
</template>
w
<script>
import { mapState, mapMutations } from 'vuex'
import { mapState, mapActions, mapMutations } from 'vuex'
import FormGroup from './components/FormGroup'
export default {
@@ -55,12 +55,13 @@
},
methods: {
...mapMutations(['alert']),
register () {
...mapActions(['register']),
performRegistration () {
this.message = '';
this.formErrors = {};
this.$store.dispatch('register', this.userData)
this.register(this.userData)
.then(response => {
if (response.data.success) {
if (response.success) {
this.alert({
message: 'Du erhältst in Kürze eine E-Mail mit einem Link zum (Zurück)setzen deines Passworts.',
success: true,
@@ -79,11 +80,11 @@
});
}
}).catch(error => {
const violations = error.response.data.violations;
const violations = error.response.violations;
for (let violation of violations) {
this.$set(this.formErrors, violation.property_path, violation.message);
}
});
})
}
},
computed: {
@@ -199,6 +199,7 @@ export default new Vuex.Store({
message: 'Es ist ein Fehler aufgetreten: ' + error.message,
success: false,
})
throw error
})
.finally(() => {
commit('endLoading')