mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 12:33:40 +00:00
34 lines
854 B
TypeScript
34 lines
854 B
TypeScript
import { Component, inject } from '@angular/core'
|
|
import { Router } from '@angular/router'
|
|
import { ErrorService } from '@start9labs/shared'
|
|
import { ApiService } from 'src/app/services/api.service'
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
template: `
|
|
<tui-theme-night></tui-theme-night>
|
|
<tui-root tuiMode="onDark"><router-outlet /></tui-root>
|
|
`,
|
|
})
|
|
export class AppComponent {
|
|
private readonly api = inject(ApiService)
|
|
private readonly errorService = inject(ErrorService)
|
|
private readonly router = inject(Router)
|
|
|
|
async ngOnInit() {
|
|
try {
|
|
const inProgress = await this.api.getSetupStatus()
|
|
|
|
let route = 'home'
|
|
|
|
if (inProgress) {
|
|
route = inProgress.complete ? 'success' : 'loading'
|
|
}
|
|
|
|
await this.router.navigate([route])
|
|
} catch (e: any) {
|
|
this.errorService.handleError(e)
|
|
}
|
|
}
|
|
}
|