Files
start-os/frontend/projects/setup-wizard/src/app/app.component.ts
Aiden McClelland a29cd622c3 refactor setup wizard (#1937)
* refactor setup backend

* rework setup wizard according to new scheme

* fix bug with partitions in SW and warning message in IW

* treat localhost as LAN for launching services

* misc backend fixes

Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
2022-11-29 09:43:54 -07:00

33 lines
850 B
TypeScript

import { Component } from '@angular/core'
import { NavController } from '@ionic/angular'
import { ApiService } from './services/api/api.service'
import { ErrorToastService } from '@start9labs/shared'
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss'],
})
export class AppComponent {
constructor(
private readonly apiService: ApiService,
private readonly errorToastService: ErrorToastService,
private readonly navCtrl: NavController,
) {}
async ngOnInit() {
try {
const inProgress = await this.apiService.getStatus()
let route = '/home'
if (inProgress) {
route = inProgress.complete ? '/success' : '/loading'
}
await this.navCtrl.navigateForward(route)
} catch (e: any) {
this.errorToastService.present(e)
}
}
}