Browse Source

Fixed double time dialog with redirect

pull/6350/head
fe-dev 5 years ago
parent
commit
b774db583c
  1. 9
      ui-ngx/src/app/core/guards/confirm-on-exit.guard.ts

9
ui-ngx/src/app/core/guards/confirm-on-exit.guard.ts

@ -21,7 +21,7 @@ import { select, Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
import { AuthState } from '@core/auth/auth.models'; import { AuthState } from '@core/auth/auth.models';
import { selectAuth } from '@core/auth/auth.selectors'; import { selectAuth } from '@core/auth/auth.selectors';
import { take } from 'rxjs/operators'; import { map, take } from 'rxjs/operators';
import { DialogService } from '@core/services/dialog.service'; import { DialogService } from '@core/services/dialog.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { isDefined } from '../utils'; import { isDefined } from '../utils';
@ -69,6 +69,13 @@ export class ConfirmOnExitGuard implements CanDeactivate<HasConfirmForm & HasDir
return this.dialogService.confirm( return this.dialogService.confirm(
this.translate.instant('confirm-on-exit.title'), this.translate.instant('confirm-on-exit.title'),
this.translate.instant('confirm-on-exit.html-message') this.translate.instant('confirm-on-exit.html-message')
).pipe(
map((dialogResult) => {
if (dialogResult) {
component.confirmForm().markAsPristine();
}
return dialogResult;
})
); );
} }
} }

Loading…
Cancel
Save