+
@@ -85,6 +86,7 @@
diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js
index 4036626d8..6241d1744 100644
--- a/frontend/src/store/store.js
+++ b/frontend/src/store/store.js
@@ -4,7 +4,6 @@ import createPersistedState from 'vuex-persistedstate'
import { localeChanged } from 'vee-validate'
import i18n from '@/i18n.js'
import jwtDecode from 'jwt-decode'
-
Vue.use(Vuex)
export const mutations = {
@@ -56,6 +55,9 @@ export const mutations = {
email: (state, email) => {
state.email = email || ''
},
+ setDarkMode: (state, darkMode) => {
+ state.darkMode = !!darkMode
+ },
}
export const actions = {
@@ -71,6 +73,7 @@ export const actions = {
commit('isAdmin', data.isAdmin)
commit('hideAmountGDD', data.hideAmountGDD)
commit('hideAmountGDT', data.hideAmountGDT)
+ commit('setDarkMode', data.darkMode)
},
logout: ({ commit, state }) => {
commit('token', null)
@@ -85,6 +88,7 @@ export const actions = {
commit('hideAmountGDD', false)
commit('hideAmountGDT', true)
commit('email', '')
+ commit('setDarkMode', false)
localStorage.clear()
},
}
@@ -114,6 +118,7 @@ try {
hideAmountGDD: null,
hideAmountGDT: null,
email: '',
+ darkMode: false,
},
getters: {},
// Syncronous mutation of the state
diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js
index a6a596209..e72b984f7 100644
--- a/frontend/src/store/store.test.js
+++ b/frontend/src/store/store.test.js
@@ -199,7 +199,7 @@ describe('Vuex store', () => {
it('calls eleven commits', () => {
login({ commit, state }, commitedData)
- expect(commit).toHaveBeenCalledTimes(11)
+ expect(commit).toHaveBeenCalledTimes(12)
})
it('commits gradidoID', () => {
@@ -264,7 +264,7 @@ describe('Vuex store', () => {
it('calls twelve commits', () => {
logout({ commit, state })
- expect(commit).toHaveBeenCalledTimes(12)
+ expect(commit).toHaveBeenCalledTimes(13)
})
it('commits token', () => {