Files
HIPCTF2/frontend/src/app/app.component.ts
T

26 lines
865 B
TypeScript

import { Component, OnDestroy, OnInit, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { BootstrapService } from './core/services/bootstrap.service';
import { BootstrapEventService } from './core/services/bootstrap-event.service';
import { AuthService } from './core/services/auth.service';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
template: `<router-outlet></router-outlet>`,
})
export class AppComponent implements OnInit, OnDestroy {
private bootstrap = inject(BootstrapService);
private auth = inject(AuthService);
private readonly bootstrapEvent = inject(BootstrapEventService);
async ngOnInit() {
await this.bootstrap.load();
await this.auth.restoreSession();
this.bootstrapEvent.start();
}
ngOnDestroy(): void {
this.bootstrapEvent.stop();
}
}