remove email from store, add gradido ID

This commit is contained in:
Moriz Wahl 2023-04-18 12:49:40 +02:00
parent 488730476c
commit 0d61788e95
2 changed files with 16 additions and 16 deletions

View File

@ -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: '',

View File

@ -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', () => {