aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/components/Users/UserRow.vue
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-07-11 11:54:06 +0200
committerLouis Chemineau <louis@chmn.me>2024-07-22 17:17:35 +0200
commit1af827fdb39dd182743853e17cf5493a8b4637d2 (patch)
tree62d2d4fa8f0144d1d4159bf711b54933746bc649 /apps/settings/src/components/Users/UserRow.vue
parent1768bd628052cf3b9db7cb3c1dbee7313ee24c16 (diff)
downloadnextcloud-server-1af827fdb39dd182743853e17cf5493a8b4637d2.tar.gz
nextcloud-server-1af827fdb39dd182743853e17cf5493a8b4637d2.zip
fix(users): Improve error handling of some fields update
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/settings/src/components/Users/UserRow.vue')
-rw-r--r--apps/settings/src/components/Users/UserRow.vue56
1 files changed, 32 insertions, 24 deletions
diff --git a/apps/settings/src/components/Users/UserRow.vue b/apps/settings/src/components/Users/UserRow.vue
index 39ecebb968f..dbe17db8d1d 100644
--- a/apps/settings/src/components/Users/UserRow.vue
+++ b/apps/settings/src/components/Users/UserRow.vue
@@ -624,18 +624,21 @@ export default {
*
* @param {string} displayName The display name
*/
- updateDisplayName() {
+ async updateDisplayName() {
this.loading.displayName = true
- this.$store.dispatch('setUserData', {
- userid: this.user.id,
- key: 'displayname',
- value: this.editedDisplayName,
- }).then(() => {
- this.loading.displayName = false
+ try {
+ await this.$store.dispatch('setUserData', {
+ userid: this.user.id,
+ key: 'displayname',
+ value: this.editedDisplayName,
+ })
+
if (this.editedDisplayName === this.user.displayname) {
showSuccess(t('setting', 'Display name was successfully changed'))
}
- })
+ } finally {
+ this.loading.displayName = false
+ }
},
/**
@@ -643,21 +646,23 @@ export default {
*
* @param {string} password The email address
*/
- updatePassword() {
+ async updatePassword() {
this.loading.password = true
if (this.editedPassword.length === 0) {
showError(t('setting', "Password can't be empty"))
this.loading.password = false
} else {
- this.$store.dispatch('setUserData', {
- userid: this.user.id,
- key: 'password',
- value: this.editedPassword,
- }).then(() => {
- this.loading.password = false
+ try {
+ await this.$store.dispatch('setUserData', {
+ userid: this.user.id,
+ key: 'password',
+ value: this.editedPassword,
+ })
this.editedPassword = ''
showSuccess(t('setting', 'Password was successfully changed'))
- })
+ } finally {
+ this.loading.password = false
+ }
}
},
@@ -666,23 +671,26 @@ export default {
*
* @param {string} mailAddress The email address
*/
- updateEmail() {
+ async updateEmail() {
this.loading.mailAddress = true
if (this.editedMail === '') {
showError(t('setting', "Email can't be empty"))
this.loading.mailAddress = false
this.editedMail = this.user.email
} else {
- this.$store.dispatch('setUserData', {
- userid: this.user.id,
- key: 'email',
- value: this.editedMail,
- }).then(() => {
- this.loading.mailAddress = false
+ try {
+ await this.$store.dispatch('setUserData', {
+ userid: this.user.id,
+ key: 'email',
+ value: this.editedMail,
+ })
+
if (this.editedMail === this.user.email) {
showSuccess(t('setting', 'Email was successfully changed'))
}
- })
+ } finally {
+ this.loading.mailAddress = false
+ }
}
},