Skip to content

Commit

Permalink
dismiss toast if present
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren Nelsen committed Mar 26, 2018
1 parent 2ac3ac8 commit 24e5b37
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/pages/broadcast-tx/broadcast-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class BroadcastTxPage {
public transaction: string;
public txForm: FormGroup;
private status: string;
private toast: any;

constructor(
private toastCtrl: ToastController,
Expand Down Expand Up @@ -48,12 +49,16 @@ export class BroadcastTxPage {

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 toast: any = this.toastCtrl.create({
if (this.toast) {
this.toast.dismiss();
}

this.toast = this.toastCtrl.create({
message: message,
position: 'middle',
showCloseButton: true,
dismissOnPageChange: true
});
toast.present();
this.toast.present();
}
}

0 comments on commit 24e5b37

Please sign in to comment.