mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
after successful login the saved language of the user is set
This commit is contained in:
parent
b644bbc4d9
commit
7d2801a636
@ -7,12 +7,18 @@
|
||||
<script>
|
||||
import LoginForm from '~/components/LoginForm/LoginForm.vue'
|
||||
import { VERSION } from '~/constants/terms-and-conditions-version.js'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
layout: 'no-header',
|
||||
components: {
|
||||
LoginForm,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
user: 'auth/user',
|
||||
}),
|
||||
},
|
||||
asyncData({ store, redirect }) {
|
||||
if (store.getters['auth/user'].termsAndConditionsAgreedVersion === VERSION) {
|
||||
redirect('/')
|
||||
@ -20,6 +26,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleSuccess() {
|
||||
const currentLocale = this.$i18n.locale()
|
||||
const userSettingLocale = this.user.locale
|
||||
if (currentLocale !== userSettingLocale) {
|
||||
this.$i18n.set(userSettingLocale)
|
||||
}
|
||||
this.$router.replace(this.$route.query.path || '/')
|
||||
},
|
||||
},
|
||||
|
||||
@ -46,6 +46,9 @@ export const getters = {
|
||||
termsAndConditionsAgreed(state) {
|
||||
return state.user && state.user.termsAndConditionsAgreedVersion === VERSION
|
||||
},
|
||||
locale(state) {
|
||||
return state.locale
|
||||
},
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
@ -84,6 +87,7 @@ export const actions = {
|
||||
role
|
||||
about
|
||||
locationName
|
||||
locale
|
||||
contributionsCount
|
||||
commentedCount
|
||||
allowEmbedIframes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user