mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
* feat: move all frontend projects under the same Angular workspace * Refactor/angular workspace (#1154) * update frontend build steps Co-authored-by: waterplea <alexander@inkin.ru> Co-authored-by: Matt Hill <matthewonthemoon@gmail.com> Co-authored-by: Lucy Cifferello <12953208+elvece@users.noreply.github.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { Component } from '@angular/core'
|
|
import { NavController } from '@ionic/angular'
|
|
import { ApiService } from './services/api/api.service'
|
|
import { ErrorToastService } from './services/error-toast.service'
|
|
import { StateService } from './services/state.service'
|
|
|
|
@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,
|
|
private readonly stateService: StateService,
|
|
) { }
|
|
|
|
async ngOnInit () {
|
|
try {
|
|
const status = await this.apiService.getStatus()
|
|
if (status.migrating || status['product-key']) {
|
|
this.stateService.hasProductKey = true
|
|
this.stateService.isMigrating = status.migrating
|
|
await this.navCtrl.navigateForward(`/product-key`)
|
|
} else {
|
|
this.stateService.hasProductKey = false
|
|
this.stateService.isMigrating = false
|
|
await this.navCtrl.navigateForward(`/recover`)
|
|
}
|
|
} catch (e) {
|
|
this.errorToastService.present(`${e.message}: ${e.details}`)
|
|
}
|
|
}
|
|
}
|