Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating displayName Reactive #2994 #3403

Merged
merged 2 commits into from
Apr 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/src/views/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,19 @@
:name="$tc('entity.user.fields.firstname')"
:uri="profile._meta.self"
fieldname="firstname"
@finished="reloadUser()"
/>
<api-text-field
:name="$tc('entity.user.fields.surname')"
:uri="profile._meta.self"
fieldname="surname"
@finished="reloadUser()"
/>
<api-text-field
:name="$tc('entity.user.fields.nickname')"
:uri="profile._meta.self"
fieldname="nickname"
@finished="reloadUser()"
/>
<api-select
:name="$tc('entity.user.fields.language')"
Expand Down Expand Up @@ -119,6 +122,13 @@ export default {
this.api.reload(this.user).then((user) => this.api.reload(user.profile()))
}
},
methods: {
reloadUser() {
this.api.reload(this.user).then((user) => {
this.$store.commit('login', user)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this more easily understandable, could you add another mutation called "updateUser" to
frontend/src/components/store/auth.js, and then use that here?
The mutation code (single line) will be duplicated, but what we're doing here isn't really a re-login, but an update of the user state. Maybe these two actions will have different behaviour in the future.

})
},
},
}
</script>

Expand Down