complete flow

This commit is contained in:
Drew Ansbacher
2021-08-10 10:35:59 -06:00
committed by Matt Hill
parent bce87cc819
commit f7b5c5fadd
15 changed files with 257 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { ModalController, NavController } from '@ionic/angular'
import { AlertController, ModalController, NavController } from '@ionic/angular'
import { ApiService, EmbassyDrive } from 'src/app/services/api/api.service'
import { StateService } from 'src/app/services/state.service'
import { PasswordPage } from '../password/password.page'
@@ -18,7 +18,8 @@ export class EmbassyPage {
private readonly apiService: ApiService,
private readonly navCtrl: NavController,
private modalController: ModalController,
private stateService: StateService
private stateService: StateService,
private readonly alertCtrl: AlertController,
) {}
async ngOnInit() {
@@ -30,12 +31,31 @@ export class EmbassyPage {
const modal = await this.modalController.create({
component: PasswordPage,
componentProps: {
embassyDrive: drive,
verify: false
embassyDrive: drive
}
})
modal.onDidDismiss().then(async ret => {
if (!ret.data) return
if (!ret.data && !ret.data.success) return
if(!!this.stateService.recoveryDrive) {
await this.navCtrl.navigateForward(`/loading`, { animationDirection: 'forward' })
} else {
const alert = await this.alertCtrl.create({
cssClass: 'success-alert',
header: 'Success!',
subHeader: `Your Embassy is set up and ready to go.`,
backdropDismiss: false,
buttons: [
{
text: 'Go To Embassy',
handler: () => {
window.location.reload()
}
}
]
})
await alert.present()
}
})
await modal.present();
}