Merge pull request #2073 from Human-Connection/Laod_saved_Laguage_and_select

1931 - after successful login the saved language of the user is set
This commit is contained in:
mattwr18 2019-11-11 11:43:12 +01:00 committed by GitHub
commit 52bdfa7c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -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,7 @@ export default {
},
methods: {
handleSuccess() {
this.$i18n.set(this.user.locale || 'en')
this.$router.replace(this.$route.query.path || '/')
},
},

View File

@ -84,6 +84,7 @@ export const actions = {
role
about
locationName
locale
contributionsCount
commentedCount
allowEmbedIframes

View File

@ -13,6 +13,7 @@ const currentUser = {
email: 'user@example.org',
avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg',
role: 'user',
locale: 'de',
}
const successfulLoginResponse = { data: { login: token } }
const successfulCurrentUserResponse = { data: { currentUser } }
@ -126,6 +127,7 @@ describe('actions', () => {
email: 'user@example.org',
avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/mutu_krish/128.jpg',
role: 'user',
locale: 'de',
},
],
]),