mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
* new flow and endpoints * functional * prod build errors addressed * little more cleanup * transfer progress fixed * tor address fix * remove eslint cause sucks * fix skeleton text color and wording Co-authored-by: Matt Hill <matthewonthemoon@gmail.com> Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { Component } from '@angular/core'
|
|
import { LoadingController, NavController } from '@ionic/angular'
|
|
import { ApiService } from 'src/app/services/api/api.service'
|
|
import { HttpService } from 'src/app/services/api/http.service'
|
|
import { StateService } from 'src/app/services/state.service'
|
|
|
|
@Component({
|
|
selector: 'app-product-key',
|
|
templateUrl: 'product-key.page.html',
|
|
styleUrls: ['product-key.page.scss'],
|
|
})
|
|
export class ProductKeyPage {
|
|
productKey: string
|
|
error: string
|
|
|
|
constructor (
|
|
private readonly navCtrl: NavController,
|
|
private readonly stateService: StateService,
|
|
private readonly apiService: ApiService,
|
|
private readonly loadingCtrl: LoadingController,
|
|
private readonly httpService: HttpService,
|
|
) { }
|
|
|
|
async submit () {
|
|
if (!this.productKey) return this.error = 'Must enter product key'
|
|
|
|
const loader = await this.loadingCtrl.create({
|
|
message: 'Verifying Product Key',
|
|
})
|
|
await loader.present()
|
|
|
|
try {
|
|
this.httpService.productKey = this.productKey
|
|
await this.apiService.verifyProductKey()
|
|
if (this.stateService.isMigrating) {
|
|
await this.navCtrl.navigateForward(`/loading`)
|
|
} else {
|
|
await this.navCtrl.navigateForward(`/home`)
|
|
}
|
|
} catch (e) {
|
|
this.error = 'Invalid Product Key'
|
|
this.httpService.productKey = undefined
|
|
} finally {
|
|
loader.dismiss()
|
|
}
|
|
}
|
|
}
|
|
|