Browse Source

Merge pull request #6350 from ArtemDzhereleiko/bug-fix/candeactivate-shows-double-time

[3.4] UI: Fixed show double dialog with redirect
pull/6412/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
9a83a4ae47
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      ui-ngx/src/app/core/guards/confirm-on-exit.guard.ts

13
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 { AuthState } from '@core/auth/auth.models';
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 { TranslateService } from '@ngx-translate/core';
import { isDefined } from '../utils';
@ -69,6 +69,17 @@ export class ConfirmOnExitGuard implements CanDeactivate<HasConfirmForm & HasDir
return this.dialogService.confirm(
this.translate.instant('confirm-on-exit.title'),
this.translate.instant('confirm-on-exit.html-message')
).pipe(
map((dialogResult) => {
if (dialogResult) {
if (component.confirmForm && component.confirmForm()) {
component.confirmForm().markAsPristine();
} else {
component.isDirty = false;
}
}
return dialogResult;
})
);
}
}

Loading…
Cancel
Save