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

View File

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