mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
fix(isa-app): Fixes Auth and TabID Errors on Startup
Refs: #5472, #5473
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -97,6 +97,7 @@ export class AuthService {
|
||||
this.#logger.info('AuthService initialized', () => ({ authenticated }));
|
||||
|
||||
this.#initialized.next(true);
|
||||
return authenticated;
|
||||
}
|
||||
|
||||
isAuthenticated() {
|
||||
|
||||
Reference in New Issue
Block a user