fix(console): username dialog response (#2888)

This commit is contained in:
Max Peintner 2021-12-22 13:00:30 +01:00 committed by GitHub
parent cf727b7fff
commit 2553bb173e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -69,7 +69,7 @@ export class AuthUserDetailComponent implements OnDestroy {
} }
public changeUsername(): void { public changeUsername(): void {
const dialogRefPhone = this.dialog.open(EditDialogComponent, { const dialogRef = this.dialog.open(EditDialogComponent, {
data: { data: {
confirmKey: 'ACTIONS.CHANGE', confirmKey: 'ACTIONS.CHANGE',
cancelKey: 'ACTIONS.CANCEL', cancelKey: 'ACTIONS.CANCEL',
@ -81,10 +81,10 @@ export class AuthUserDetailComponent implements OnDestroy {
width: '400px', width: '400px',
}); });
dialogRefPhone.afterClosed().subscribe((resp) => { dialogRef.afterClosed().subscribe((resp: { value: string }) => {
if (resp && resp !== this.user.userName) { if (resp && resp.value && resp.value !== this.user.userName) {
this.userService this.userService
.updateMyUserName(resp) .updateMyUserName(resp.value)
.then(() => { .then(() => {
this.toast.showInfo('USER.TOAST.USERNAMECHANGED', true); this.toast.showInfo('USER.TOAST.USERNAMECHANGED', true);
this.refreshUser(); this.refreshUser();

View File

@ -85,7 +85,7 @@ export class UserDetailComponent implements OnInit {
} }
public changeUsername(): void { public changeUsername(): void {
const dialogRefPhone = this.dialog.open(EditDialogComponent, { const dialogRef = this.dialog.open(EditDialogComponent, {
data: { data: {
confirmKey: 'ACTIONS.CHANGE', confirmKey: 'ACTIONS.CHANGE',
cancelKey: 'ACTIONS.CANCEL', cancelKey: 'ACTIONS.CANCEL',
@ -97,10 +97,10 @@ export class UserDetailComponent implements OnInit {
width: '400px', width: '400px',
}); });
dialogRefPhone.afterClosed().subscribe((resp) => { dialogRef.afterClosed().subscribe((resp: { value: string }) => {
if (resp && resp !== this.user.userName) { if (resp.value && resp.value !== this.user.userName) {
this.mgmtUserService this.mgmtUserService
.updateUserName(this.user.id, resp) .updateUserName(this.user.id, resp.value)
.then(() => { .then(() => {
this.toast.showInfo('USER.TOAST.USERNAMECHANGED', true); this.toast.showInfo('USER.TOAST.USERNAMECHANGED', true);
this.refreshUser(); this.refreshUser();