mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
rest api update user
This commit is contained in:
parent
460953847b
commit
98772bc320
@ -93,7 +93,7 @@ const loginAPI = {
|
||||
update: {
|
||||
'User.first_name': data.firstName,
|
||||
'User.last_name': data.lastName,
|
||||
/* 'User.description': description, */
|
||||
'User.description': data.description,
|
||||
},
|
||||
}
|
||||
return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload)
|
||||
|
||||
@ -22,6 +22,9 @@ export const mutations = {
|
||||
lastName: (state, lastName) => {
|
||||
state.lastName = lastName
|
||||
},
|
||||
description: (state, description) => {
|
||||
state.description = description
|
||||
},
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
@ -32,6 +35,7 @@ export const actions = {
|
||||
commit('username', data.user.username)
|
||||
commit('firstName', data.user.first_name)
|
||||
commit('lastName', data.user.last_name)
|
||||
commit('description', data.user.description)
|
||||
},
|
||||
logout: ({ commit, state }) => {
|
||||
commit('sessionId', null)
|
||||
@ -39,6 +43,7 @@ export const actions = {
|
||||
commit('username', '')
|
||||
commit('firstName', '')
|
||||
commit('lastName', '')
|
||||
commit('description', '')
|
||||
sessionStorage.clear()
|
||||
},
|
||||
}
|
||||
@ -57,6 +62,7 @@ export const store = new Vuex.Store({
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
username: '',
|
||||
description: '',
|
||||
},
|
||||
getters: {},
|
||||
// Syncronous mutation of the state
|
||||
|
||||
@ -40,7 +40,7 @@ describe('Vuex store', () => {
|
||||
{ commit, state },
|
||||
{ sessionId: 1234, user: { email: 'someone@there.is', language: 'en' } },
|
||||
)
|
||||
expect(commit).toHaveBeenCalledTimes(6)
|
||||
expect(commit).toHaveBeenCalledTimes(7)
|
||||
})
|
||||
|
||||
it('commits sessionId', () => {
|
||||
@ -74,7 +74,7 @@ describe('Vuex store', () => {
|
||||
|
||||
it('calls two commits', () => {
|
||||
logout({ commit, state })
|
||||
expect(commit).toHaveBeenCalledTimes(5)
|
||||
expect(commit).toHaveBeenCalledTimes(6)
|
||||
})
|
||||
|
||||
it('commits sessionId', () => {
|
||||
|
||||
@ -52,10 +52,10 @@
|
||||
<small>{{ $t('form.description') }}</small>
|
||||
</b-col>
|
||||
<b-col v-if="editUserdata" class="col-md-9 col-sm-10">
|
||||
{{ UserProfileTestData.desc }}
|
||||
{{ form.description }}
|
||||
</b-col>
|
||||
<b-col v-else class="col-md-9 col-sm-10">
|
||||
<b-textarea rows="3" max-rows="6" v-model="form.desc"></b-textarea>
|
||||
<b-textarea rows="3" max-rows="6" v-model="form.description"></b-textarea>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
@ -78,7 +78,7 @@ export default {
|
||||
form: {
|
||||
firstName: this.$store.state.firstName,
|
||||
lastName: this.$store.state.lastName,
|
||||
desc: this.UserProfileTestData.desc,
|
||||
description: this.$store.state.description,
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -90,11 +90,13 @@ export default {
|
||||
{
|
||||
firstName: this.form.firstName,
|
||||
lastName: this.form.lastName,
|
||||
description: this.form.description,
|
||||
},
|
||||
)
|
||||
if (result.success) {
|
||||
this.$store.commit('firstName', this.form.firstName)
|
||||
this.$store.commit('lastName', this.form.lastName)
|
||||
this.$store.commit('description', this.form.description)
|
||||
this.editUserdata = true
|
||||
} else {
|
||||
alert(result.result.message)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user