fix(isa-app): Fixes Auth and TabID Errors on Startup

Refs: #5472, #5473
This commit is contained in:
Nino
2025-11-12 12:40:59 +01:00
parent 989294cc90
commit b827a6f0a0
5 changed files with 43 additions and 3 deletions

View File

@@ -29,7 +29,11 @@ import {
ActivateProcessIdWithConfigKeyGuard,
} from './guards/activate-process-id.guard';
import { MatomoRouteData } from 'ngx-matomo-client';
import { tabResolverFn, processResolverFn } from '@isa/core/tabs';
import {
tabResolverFn,
processResolverFn,
hasTabIdGuard,
} from '@isa/core/tabs';
import { provideScrollPositionRestoration } from '@isa/utils/scroll-position';
const routes: Routes = [
@@ -182,7 +186,7 @@ const routes: Routes = [
path: ':tabId',
component: MainComponent,
resolve: { process: processResolverFn, tab: tabResolverFn },
canActivate: [IsAuthenticatedGuard],
canActivate: [IsAuthenticatedGuard, hasTabIdGuard],
children: [
{
path: 'reward',

View File

@@ -131,7 +131,10 @@ export function _appInitializerFactory(config: Config, injector: Injector) {
const auth = injector.get(AuthService);
try {
await auth.init();
const authenticated = await auth.init();
if (!authenticated) {
throw new Error('User is not authenticated');
}
} catch {
statusElement.innerHTML = 'Authentifizierung wird durchgeführt...';
logger.info('Performing login');

View File

@@ -97,6 +97,7 @@ export class AuthService {
this.#logger.info('AuthService initialized', () => ({ authenticated }));
this.#initialized.next(true);
return authenticated;
}
isAuthenticated() {