In case of language switch success change language in store.

This commit is contained in:
elweyn 2021-09-22 11:32:46 +02:00
parent a404be1cfb
commit 8a5b552a11

View File

@ -23,13 +23,13 @@
<b>{{ $t('language') }}</b> <b>{{ $t('language') }}</b>
</small> </small>
</b-col> </b-col>
<b-col class="col-12">{{ $store.state.language }}</b-col> <b-col class="col-12">{{ $t(buildLanguage()) }}</b-col>
</b-row> </b-row>
</div> </div>
<div v-else> <div v-else>
<div> <div>
<b-form @submit.stop.prevent="handleSubmit(onSubmit)"> <b-form @submit.stop.prevent="onSubmit">
<b-row class="mb-2"> <b-row class="mb-2">
<b-col class="col-12"> <b-col class="col-12">
<small> <small>
@ -93,17 +93,22 @@ export default {
.query({ .query({
query: updateUserInfos, query: updateUserInfos,
variables: { variables: {
email: this.$store.email, email: this.$store.state.email,
language: this.$store.state.language, locale: this.language,
}, },
}) })
.then(() => { .then(() => {
this.$store.commit('language', this.language)
this.cancelEdit() this.cancelEdit()
}) })
.catch((error) => { .catch((error) => {
this.$toasted.error(error.message) this.$toasted.error(error.message)
}) })
}, },
buildLanguage() {
return 'languages.' + this.$store.state.language
},
}, },
} }
</script> </script>