|
|
@@ -5,6 +5,8 @@ import { catchError, map } from 'rxjs';
|
|
|
import { ResponseData } from 'src/app/interfaces/response-data';
|
|
|
import { MESMCCInterface } from '../../../interfaces/mes/mesmcc/mesmcc-interface';
|
|
|
import { IAMService } from '../../iam/iam.service';
|
|
|
+import { AlertaComponent } from 'src/app/components/resources/dialogos/alerta/alerta.component';
|
|
|
+import { MatDialog } from '@angular/material/dialog';
|
|
|
|
|
|
@Injectable({
|
|
|
providedIn: 'root',
|
|
|
@@ -17,7 +19,8 @@ export class MESMCCService {
|
|
|
constructor(
|
|
|
private _http: HttpClient,
|
|
|
private _snackBar: MatSnackBar,
|
|
|
- private _iamService: IAMService
|
|
|
+ private _iamService: IAMService,
|
|
|
+ public dialog: MatDialog
|
|
|
) {}
|
|
|
|
|
|
actualizarContrasena(data: MESMCCInterface) {
|
|
|
@@ -28,8 +31,10 @@ export class MESMCCService {
|
|
|
.subscribe(
|
|
|
(res) => {
|
|
|
if (!res.error) {
|
|
|
- this._iamService.logout();
|
|
|
- this.snackAlert('¡Contraseña Cambiada! Ingrese sus credenciales de acceso de nuevo');
|
|
|
+ this.snackAlert(
|
|
|
+ '¡Contraseña Cambiada! Ingrese sus credenciales de acceso de nuevo'
|
|
|
+ );
|
|
|
+ this.openDialog(null, '');
|
|
|
} else {
|
|
|
this.snackAlert(res.msg);
|
|
|
}
|
|
|
@@ -53,4 +58,25 @@ export class MESMCCService {
|
|
|
duration: 4000,
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ openDialog(item: any, action: String) {
|
|
|
+ let dataAction = {};
|
|
|
+
|
|
|
+ dataAction = {
|
|
|
+ titulo: 'Cambio de contraseña',
|
|
|
+ descripcion: `La contraseña fue cambiada, se realizar el cierre de sesión para volver a confirmar los datos.`,
|
|
|
+ };
|
|
|
+
|
|
|
+ const dialogRef = this.dialog.open(AlertaComponent, {
|
|
|
+ data: dataAction,
|
|
|
+ disableClose: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ dialogRef.afterClosed().subscribe((result) => {
|
|
|
+ if (result) {
|
|
|
+ //this.eliminar(item);
|
|
|
+ this._iamService.logout();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|