diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 62ea680df..799ff25bc 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -78,6 +78,47 @@ const loginAPI = { CONFIG.LOGIN_API_URL + 'loginViaEmailVerificationCode?emailVerificationCode=' + optin, ) }, + getUserInfos: async (sessionId, email) => { + const payload = { + session_id: sessionId, + email: email, + ask: ['user.first_name', 'user.last_name'], + } + return apiPost(CONFIG.LOGIN_API_URL + 'getUserInfos', payload) + }, + updateUserInfos: async (sessionId, email, firstName, lastName /*, description */) => { + const payload = { + session_id: sessionId, + email, + update: { + 'User.first_name': firstName, + 'User.last_name': lastName, + /* 'User.description': description, */ + }, + } + return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) + }, + + // `POST http://localhost/login_api/getUserInfos` + // + // with: + // + // ```json + // { + // "session_id": -127182, + // "email": "max.musterman@gmail.de", + // "ask": [ + // "EmailVerificationCode.Register", + // "loginServer.path", + // "user.pubkeyhex", + // "user.first_name", + // "user.last_name", + // "user.disabled", + // "user.email_checked", + // "user.language" + // ] + // } + changePassword: async (sessionId, email, password) => { const payload = { session_id: sessionId, @@ -99,16 +140,6 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, - changeEmailProfil: async (sessionId, email, emailNew) => { - const payload = { - session_id: sessionId, - email, - update: { - 'User.emailNew': emailNew, - }, - } - return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) - }, changeUsernameProfil: async (sessionId, email, usernameNew) => { const payload = { session_id: sessionId, @@ -129,18 +160,6 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, - updateUserdata: async (sessionId, email, firstName, lastName, description) => { - const payload = { - session_id: sessionId, - email, - update: { - 'User.first_name': firstName, - 'User.last_name': lastName, - 'User.description': description, - }, - } - return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) - }, } export default loginAPI diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 1d89894fb..79f04da61 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -13,6 +13,10 @@ export const mutations = { sessionId: (state, sessionId) => { state.sessionId = sessionId }, + username: (state, username) => { + // console.log('store username mutation', username) + state.username = username + }, } export const actions = { @@ -20,10 +24,12 @@ export const actions = { commit('sessionId', data.sessionId) commit('email', data.user.email) commit('language', data.user.language) + commit('username', data.user.username ? '' : 'teststoreusername') }, logout: ({ commit, state }) => { commit('sessionId', null) commit('email', null) + commit('username', null) sessionStorage.clear() }, } @@ -39,6 +45,7 @@ export const store = new Vuex.Store({ email: '', language: null, modals: false, + username: 'testname', }, getters: {}, // Syncronous mutation of the state diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js index 11dd5949b..3f466f723 100644 --- a/frontend/src/store/store.test.js +++ b/frontend/src/store/store.test.js @@ -40,7 +40,7 @@ describe('Vuex store', () => { { commit, state }, { sessionId: 1234, user: { email: 'someone@there.is', language: 'en' } }, ) - expect(commit).toHaveBeenCalledTimes(3) + expect(commit).toHaveBeenCalledTimes(4) }) it('commits sessionId', () => { @@ -74,7 +74,7 @@ describe('Vuex store', () => { it('calls two commits', () => { logout({ commit, state }) - expect(commit).toHaveBeenCalledTimes(2) + expect(commit).toHaveBeenCalledTimes(3) }) it('commits sessionId', () => { diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 81d8b6432..2e66c11d6 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -87,8 +87,6 @@ export default { pending: true, UserProfileTestData: { username: 'Mustermax', - name: 'Max', - lastname: 'Mustermann', desc: 'Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. ', }, diff --git a/frontend/src/views/Pages/UserProfile/UserCard.vue b/frontend/src/views/Pages/UserProfile/UserCard.vue index 1e94867e6..94c21fdaf 100755 --- a/frontend/src/views/Pages/UserProfile/UserCard.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard.vue @@ -14,7 +14,7 @@ GDD
- {{ $n(transactionCount) }} + {{ transactionCount }} {{ $t('transactions') }}
diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index 2e27db338..723a5cee9 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -25,10 +25,10 @@ {{ $t('form.firstname') }} - {{ UserProfileTestData.name }} + {{ userdata.first_name }} - + @@ -36,10 +36,10 @@ {{ $t('form.lastname') }} - {{ UserProfileTestData.lastname }} + {{ userdata.last_name }} - + @@ -50,12 +50,7 @@ {{ UserProfileTestData.desc }} - +
@@ -63,39 +58,37 @@