Skip to content
Snippets Groups Projects
Commit f81e6dba authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #15550 TIME 0:10 remove confirm modal

parent 8d445b2d
No related branches found
No related tags found
No related merge requests found
...@@ -2,12 +2,11 @@ import { Component, OnInit } from '@angular/core'; ...@@ -2,12 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { SignaturesContentService } from '../../service/signatures.service'; import { SignaturesContentService } from '../../service/signatures.service';
import { NotificationService } from '../../service/notification.service'; import { NotificationService } from '../../service/notification.service';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { finalize } from 'rxjs/operators'; import { finalize } from 'rxjs/operators';
import { ConfirmComponent } from '../../plugins/confirm.component';
import { AuthService } from '../../service/auth.service'; import { AuthService } from '../../service/auth.service';
import { AlertController } from '@ionic/angular';
export interface Privilege { export interface Privilege {
...@@ -42,8 +41,13 @@ export class ConnectionComponent implements OnInit { ...@@ -42,8 +41,13 @@ export class ConnectionComponent implements OnInit {
currentConnection: Connection; currentConnection: Connection;
constructor(public http: HttpClient, private translate: TranslateService, private route: ActivatedRoute, private router: Router, public signaturesService: SignaturesContentService, public notificationService: NotificationService, public dialog: MatDialog, public authService: AuthService) { constructor(
} public http: HttpClient,
public signaturesService: SignaturesContentService,
public notificationService: NotificationService,
public alertController: AlertController,
public authService: AuthService
) { }
ngOnInit(): void { ngOnInit(): void {
this.loading = true; this.loading = true;
...@@ -71,23 +75,16 @@ export class ConnectionComponent implements OnInit { ...@@ -71,23 +75,16 @@ export class ConnectionComponent implements OnInit {
}); });
} }
changeConnection(connection: any) { async changeConnection(connection: any) {
const dialogRef = this.dialog.open(ConfirmComponent, { autoFocus: false, data: { mode: 'warning', title: 'lang.confirmMsg', msg: 'lang.changeConnectionWarn' } }); this.http.patch('../rest/configurations/' + this.id, { label: this.label, value: connection })
.pipe(
dialogRef.afterClosed().subscribe(result => { finalize(() => this.loading = false)
if (result === 'yes') { )
this.loading = true; .subscribe({
this.http.patch('../rest/configurations/' + this.id, { label: this.label, value: connection }) next: () => {
.pipe( this.authService.authMode = connection;
finalize(() => this.loading = false) this.notificationService.success('lang.connectionModeUpdated');
) },
.subscribe({ });
next: () => {
this.authService.updateUserInfoWithTokenRefresh();
this.notificationService.success('lang.connectionModeUpdated');
},
});
}
});
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment