dismiss toast if present
This commit is contained in:
parent
2ac3ac8cd3
commit
24e5b376ab
@ -16,6 +16,7 @@ export class BroadcastTxPage {
|
|||||||
public transaction: string;
|
public transaction: string;
|
||||||
public txForm: FormGroup;
|
public txForm: FormGroup;
|
||||||
private status: string;
|
private status: string;
|
||||||
|
private toast: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private toastCtrl: ToastController,
|
private toastCtrl: ToastController,
|
||||||
@ -48,12 +49,16 @@ export class BroadcastTxPage {
|
|||||||
|
|
||||||
private presentToast(success: boolean, response: any): void {
|
private presentToast(success: boolean, response: any): void {
|
||||||
let message: string = (success) ? 'Transaction successfully broadcast. Trasaction id: ' + JSON.parse(response._body).txid : 'An error occurred: ' + response._body;
|
let message: string = (success) ? 'Transaction successfully broadcast. Trasaction id: ' + JSON.parse(response._body).txid : 'An error occurred: ' + response._body;
|
||||||
let toast: any = this.toastCtrl.create({
|
if (this.toast) {
|
||||||
|
this.toast.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.toast = this.toastCtrl.create({
|
||||||
message: message,
|
message: message,
|
||||||
position: 'middle',
|
position: 'middle',
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
dismissOnPageChange: true
|
dismissOnPageChange: true
|
||||||
});
|
});
|
||||||
toast.present();
|
this.toast.present();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user