Merge branch 'VM/DM-451' into 'master'
DM-451 - Clicking the 'Back' button does not lead to navigating to the previous page Closes DM-451 See merge request redactmanager/red-ui!90
This commit is contained in:
commit
654cb50c2d
@ -5,6 +5,7 @@ import { keycloakInitializer, KeycloakStatusService, TenantsService } from '@iqs
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { UserService } from '@users/user.service';
|
||||
import { LicenseService } from '@services/license.service';
|
||||
import { RouterHistoryService } from '@services/router-history.service';
|
||||
|
||||
export function ifLoggedIn(): CanActivateFn {
|
||||
return async (route: ActivatedRouteSnapshot) => {
|
||||
@ -16,6 +17,7 @@ export function ifLoggedIn(): CanActivateFn {
|
||||
const usersService = inject(UserService);
|
||||
const licenseService = inject(LicenseService);
|
||||
const keycloakStatusService = inject(KeycloakStatusService);
|
||||
const routerHistoryService = inject(RouterHistoryService);
|
||||
|
||||
const keycloakInstance = keycloakService.getKeycloakInstance();
|
||||
const tenant = route.paramMap.get('tenant');
|
||||
@ -34,6 +36,7 @@ export function ifLoggedIn(): CanActivateFn {
|
||||
await tenantsService.selectTenant(tenant);
|
||||
await usersService.initialize();
|
||||
await licenseService.loadLicenses();
|
||||
routerHistoryService.clearRouterHistory();
|
||||
}
|
||||
|
||||
const isLoggedIn = await keycloakService.isLoggedIn();
|
||||
|
||||
@ -11,7 +11,10 @@ const LAST_DOSSIERS_SCREEN = 'routerHistory_lastDossiersScreen';
|
||||
export class RouterHistoryService {
|
||||
private _lastDossiersScreen = localStorage.getItem(LAST_DOSSIERS_SCREEN);
|
||||
|
||||
constructor(private readonly _router: Router, private readonly _tenantsService: TenantsService) {
|
||||
constructor(
|
||||
private readonly _router: Router,
|
||||
private readonly _tenantsService: TenantsService,
|
||||
) {
|
||||
// eslint-disable-next-line rxjs/no-ignored-subscription
|
||||
this._router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {
|
||||
if (event.url.includes('/dossiers') || event.url.includes('/archive')) {
|
||||
@ -30,4 +33,8 @@ export class RouterHistoryService {
|
||||
this._router.navigate([url]);
|
||||
}
|
||||
}
|
||||
|
||||
clearRouterHistory() {
|
||||
localStorage.removeItem(LAST_DOSSIERS_SCREEN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit d1df30b56ea5abd03b0c8623f68fc96db9fef271
|
||||
Subproject commit 6cb63fcf43fbbf522b847f57467156808bbe72a1
|
||||
Loading…
x
Reference in New Issue
Block a user