src.app.core.guards.can-deactivate.guard.ts Maven / Gradle / Ivy
The newest version!
/*
* SPDX-FileCopyrightText: 2017-2024 Enedis
*
* SPDX-License-Identifier: Apache-2.0
*
*/
import { inject } from '@angular/core';
import { CanDeactivateFn } from '@angular/router';
import { CanDeactivatePage } from './page';
import { TranslateService } from '@ngx-translate/core';
export const canDeactivateGuard : CanDeactivateFn = (page: CanDeactivatePage) => {
if (page && page.canDeactivatePage && !page.canDeactivatePage()) {
const translationService = inject(TranslateService);
return confirm(translationService.instant('global.confirm.page.deactivate'));
}
return true;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy