Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x | import { Injectable } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { Observable, of, switchMap } from 'rxjs'; import { BackendService } from '../backend.service'; import { NewPasswordComponent } from '../../components/newpassword/new-password.component'; @Injectable({ providedIn: 'root' }) export class PasswordChangeService { constructor( private newpasswordDialog: MatDialog, private bs: BackendService ) { } showPasswordChangeDialog(user: { id: number; name: string }, option: MatDialogConfig = {}): Observable<boolean> { const dialogRef = this.newpasswordDialog.open(NewPasswordComponent, { width: '600px', data: user.name, ...option }); return dialogRef.afterClosed().pipe( switchMap(result => { Iif (!result) { return of(true); // true in sense of "errorCode other than 0" } return this.bs.changePassword( user.id, result.get('pw').value ); })); } } |