Commit b378a661 authored by anton's avatar anton

Fix user management

Closes #340
parent 325456f0
Pipeline #50891 passed with stage
in 2 minutes and 30 seconds
......@@ -75,19 +75,16 @@
}
},
submit: {
handler () {
return context.$store.dispatch('profiles/patch', [context.$store.state.auth.user.uuid, context.payload]).then(() => {
return context.$store.dispatch('profiles/get', context.$store.state.auth.user.uuid)
}).then(profile => {
const user = context.$store.state.auth.user
user.profile = profile
context.$store.commit('auth/setUser', user)
localStorage.setItem('user', JSON.stringify(user))
}).then(() => {
if (context.$route.params.isFirst && context.$route.params.redirect) {
context.$router.push(context.$route.params.redirect.fullPath)
}
})
async handler () {
const profile = await context.$store.dispatch('profiles/patch', [context.$store.state.auth.user.uuid, context.payload])
if (profile) {
const user = Object.assign({}, context.$store.state.auth.user)
user.profile = Object.assign({}, user.profile, profile)
context.$auth._setUser(user, context.$store)
}
if (context.$route.params.isFirst && context.$route.params.redirect) {
context.$router.push(context.$route.params.redirect.fullPath)
}
},
label: 'buttons.save',
message: 'messages.update_success'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment