-
- Deutsch
- English
+
+
+ {{ lang.name }}
+
diff --git a/frontend/src/components/SidebarPlugin/SideBar.spec.js b/frontend/src/components/SidebarPlugin/SideBar.spec.js
index 36230849f..9f9ce8a8f 100644
--- a/frontend/src/components/SidebarPlugin/SideBar.spec.js
+++ b/frontend/src/components/SidebarPlugin/SideBar.spec.js
@@ -19,6 +19,7 @@ describe('SideBar', () => {
state: {
email: 'test@example.org',
},
+ commit: jest.fn(),
},
$i18n: {
locale: 'en',
diff --git a/frontend/src/locales/index.js b/frontend/src/locales/index.js
new file mode 100644
index 000000000..4cb375b40
--- /dev/null
+++ b/frontend/src/locales/index.js
@@ -0,0 +1,16 @@
+const locales = [
+ {
+ name: 'English',
+ code: 'en',
+ iso: 'en-US',
+ enabled: true,
+ },
+ {
+ name: 'Deutsch',
+ code: 'de',
+ iso: 'de-DE',
+ enabled: true,
+ },
+]
+
+export default locales
diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js
index aed286bc6..1d89894fb 100644
--- a/frontend/src/store/store.js
+++ b/frontend/src/store/store.js
@@ -18,7 +18,8 @@ export const mutations = {
export const actions = {
login: ({ dispatch, commit }, data) => {
commit('sessionId', data.sessionId)
- commit('email', data.email)
+ commit('email', data.user.email)
+ commit('language', data.user.language)
},
logout: ({ commit, state }) => {
commit('sessionId', null)
@@ -36,7 +37,7 @@ export const store = new Vuex.Store({
state: {
sessionId: null,
email: '',
- language: 'en',
+ language: null,
modals: false,
},
getters: {},
diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js
index 655cca7a0..11dd5949b 100644
--- a/frontend/src/store/store.test.js
+++ b/frontend/src/store/store.test.js
@@ -35,20 +35,37 @@ describe('Vuex store', () => {
const commit = jest.fn()
const state = {}
- it('calls two commits', () => {
- login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
- expect(commit).toHaveBeenCalledTimes(2)
+ it('calls three commits', () => {
+ login(
+ { commit, state },
+ { sessionId: 1234, user: { email: 'someone@there.is', language: 'en' } },
+ )
+ expect(commit).toHaveBeenCalledTimes(3)
})
it('commits sessionId', () => {
- login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
+ login(
+ { commit, state },
+ { sessionId: 1234, user: { email: 'someone@there.is', language: 'en' } },
+ )
expect(commit).toHaveBeenNthCalledWith(1, 'sessionId', 1234)
})
it('commits email', () => {
- login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
+ login(
+ { commit, state },
+ { sessionId: 1234, user: { email: 'someone@there.is', language: 'en' } },
+ )
expect(commit).toHaveBeenNthCalledWith(2, 'email', 'someone@there.is')
})
+
+ it('commits language', () => {
+ login(
+ { commit, state },
+ { sessionId: 1234, user: { email: 'someone@there.is', language: 'en' } },
+ )
+ expect(commit).toHaveBeenNthCalledWith(3, 'language', 'en')
+ })
})
describe('logout', () => {
diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js
index 8c1e604c0..84c955042 100644
--- a/frontend/src/views/Layout/DashboardLayout_gdd.spec.js
+++ b/frontend/src/views/Layout/DashboardLayout_gdd.spec.js
@@ -44,6 +44,9 @@ describe('DashboardLayoutGdd', () => {
const store = new Vuex.Store({
state,
+ mutations: {
+ language: jest.fn(),
+ },
})
const Wrapper = () => {
diff --git a/frontend/src/views/Pages/Login.spec.js b/frontend/src/views/Pages/Login.spec.js
index c95aa5a4c..0d94840b0 100644
--- a/frontend/src/views/Pages/Login.spec.js
+++ b/frontend/src/views/Pages/Login.spec.js
@@ -1,5 +1,4 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
-import Vuex from 'vuex'
import flushPromises from 'flush-promises'
import Login from './Login'
@@ -16,20 +15,12 @@ describe('Login', () => {
$t: jest.fn((t) => t),
}
- const state = {
- loginfail: false,
- }
-
- const store = new Vuex.Store({
- state,
- })
-
const stubs = {
RouterLink: RouterLinkStub,
}
const Wrapper = () => {
- return mount(Login, { localVue, mocks, store, stubs })
+ return mount(Login, { localVue, mocks, stubs })
}
describe('mount', () => {
diff --git a/frontend/src/views/Pages/Login.vue b/frontend/src/views/Pages/Login.vue
index c3c3b1bd0..a6d795bb1 100755
--- a/frontend/src/views/Pages/Login.vue
+++ b/frontend/src/views/Pages/Login.vue
@@ -122,7 +122,7 @@ export default {
if (result.success) {
this.$store.dispatch('login', {
sessionId: result.result.data.session_id,
- email: this.model.email,
+ user: result.result.data.user,
})
this.$router.push('/overview')
loader.hide()
diff --git a/frontend/src/views/Pages/Register.spec.js b/frontend/src/views/Pages/Register.spec.js
index dcb97cf42..3d4296567 100644
--- a/frontend/src/views/Pages/Register.spec.js
+++ b/frontend/src/views/Pages/Register.spec.js
@@ -1,5 +1,4 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
-import Vuex from 'vuex'
import flushPromises from 'flush-promises'
import Register from './Register'
@@ -16,20 +15,12 @@ describe('Register', () => {
$t: jest.fn((t) => t),
}
- const state = {
- // loginfail: false,
- }
-
- const store = new Vuex.Store({
- state,
- })
-
const stubs = {
RouterLink: RouterLinkStub,
}
const Wrapper = () => {
- return mount(Register, { localVue, mocks, store, stubs })
+ return mount(Register, { localVue, mocks, stubs })
}
describe('mount', () => {