Merge pull request #6350 from ArtemDzhereleiko/bug-fix/candeactivate-shows-double-time
[3.4] UI: Fixed show double dialog with redirect
This commit is contained in:
commit
9a83a4ae47
@ -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,17 @@ 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) {
|
||||||
|
if (component.confirmForm && component.confirmForm()) {
|
||||||
|
component.confirmForm().markAsPristine();
|
||||||
|
} else {
|
||||||
|
component.isDirty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dialogResult;
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user