From 0d61788e958a46661de6e09fe8d0349f9f1755da Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 18 Apr 2023 12:49:40 +0200 Subject: [PATCH] remove email from store, add gradido ID --- frontend/src/store/store.js | 10 +++++----- frontend/src/store/store.test.js | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 1cd874c06..436a2d32b 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -13,8 +13,8 @@ export const mutations = { localeChanged(language) state.language = language }, - email: (state, email) => { - state.email = email + gradidoID: (state, gradidoID) => { + state.gradidoID = gradidoID }, // username: (state, username) => { // state.username = username @@ -57,7 +57,7 @@ export const mutations = { export const actions = { login: ({ dispatch, commit }, data) => { - commit('email', data.email) + commit('gradidoID', data.gradidoID) commit('language', data.language) // commit('username', data.username) commit('firstName', data.firstName) @@ -71,8 +71,8 @@ export const actions = { }, logout: ({ commit, state }) => { commit('token', null) - commit('email', null) // commit('username', '') + commit('gradidoID', null) commit('firstName', '') commit('lastName', '') commit('newsletterState', null) @@ -95,8 +95,8 @@ try { }), ], state: { - email: '', language: null, + gradidoID: null, firstName: '', lastName: '', // username: '', diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js index 33fedd562..cc4d6a284 100644 --- a/frontend/src/store/store.test.js +++ b/frontend/src/store/store.test.js @@ -22,7 +22,7 @@ i18n.locale = 'blubb' const { language, - email, + gradidoID, token, firstName, lastName, @@ -53,11 +53,11 @@ describe('Vuex store', () => { }) }) - describe('email', () => { - it('sets the state of email', () => { - const state = { email: 'nobody@knows.tv' } - email(state, 'someone@there.is') - expect(state.email).toEqual('someone@there.is') + describe('gradidoID', () => { + it('sets the state of gradidoID', () => { + const state = { gradidoID: 'old-id' } + gradidoID(state, 'new-id') + expect(state.gradidoID).toEqual('new-id') }) }) @@ -164,7 +164,7 @@ describe('Vuex store', () => { const commit = jest.fn() const state = {} const commitedData = { - email: 'user@example.org', + gradidoID: 'my-gradido-id', language: 'de', firstName: 'Peter', lastName: 'Lustig', @@ -183,9 +183,9 @@ describe('Vuex store', () => { expect(commit).toHaveBeenCalledTimes(10) }) - it('commits email', () => { + it('commits gradidoID', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(1, 'email', 'user@example.org') + expect(commit).toHaveBeenNthCalledWith(1, 'gradidoID', 'my-gradido-id') }) it('commits language', () => { @@ -248,9 +248,9 @@ describe('Vuex store', () => { expect(commit).toHaveBeenNthCalledWith(1, 'token', null) }) - it('commits email', () => { + it('commits gradidoID', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(2, 'email', null) + expect(commit).toHaveBeenNthCalledWith(2, 'gradidoID', null) }) it('commits firstName', () => {