Commit af74d078 authored by dev0tion's avatar dev0tion

Blank pop up workaround

parent e042fbe8
...@@ -28,13 +28,11 @@ export class DashboardComponent implements OnInit { ...@@ -28,13 +28,11 @@ export class DashboardComponent implements OnInit {
private walletHistorySubscription: Subscription; private walletHistorySubscription: Subscription;
ngOnInit() { ngOnInit() {
this.getWalletBalance(); this.startSubscriptions();
this.getHistory();
}; };
ngOnDestroy() { ngOnDestroy() {
this.walletBalanceSubscription.unsubscribe(); this.cancelSubscriptions();
this.walletHistorySubscription.unsubscribe();
}; };
private openSendDialog() { private openSendDialog() {
...@@ -70,7 +68,12 @@ export class DashboardComponent implements OnInit { ...@@ -70,7 +68,12 @@ export class DashboardComponent implements OnInit {
console.log(error); console.log(error);
} }
else { else {
alert(error.json().errors[0].description); if (error.json().errors[0].description) {
alert(error.json().errors[0].description);
} else {
this.cancelSubscriptions();
this.startSubscriptions();
}
} }
} }
} }
...@@ -98,11 +101,31 @@ export class DashboardComponent implements OnInit { ...@@ -98,11 +101,31 @@ export class DashboardComponent implements OnInit {
console.log(error); console.log(error);
} }
else { else {
alert(error.json().errors[0].description); if (error.json().errors[0].description) {
alert(error.json().errors[0].description);
} else {
this.cancelSubscriptions();
this.startSubscriptions();
}
} }
} }
} }
) )
; ;
}; };
private cancelSubscriptions() {
if (this.walletBalanceSubscription) {
this.walletBalanceSubscription.unsubscribe();
}
if(this.walletHistorySubscription) {
this.walletHistorySubscription.unsubscribe();
}
};
private startSubscriptions() {
this.getWalletBalance();
this.getHistory();
}
} }
...@@ -25,11 +25,11 @@ export class HistoryComponent { ...@@ -25,11 +25,11 @@ export class HistoryComponent {
private walletHistorySubscription: Subscription; private walletHistorySubscription: Subscription;
ngOnInit() { ngOnInit() {
this.getHistory(); this.startSubscriptions();
} }
ngOnDestroy() { ngOnDestroy() {
this.walletHistorySubscription.unsubscribe(); this.cancelSubscriptions();
} }
private openTransactionDetailDialog(transaction: any) { private openTransactionDetailDialog(transaction: any) {
...@@ -57,11 +57,26 @@ export class HistoryComponent { ...@@ -57,11 +57,26 @@ export class HistoryComponent {
console.log(error); console.log(error);
} }
else { else {
alert(error.json().errors[0].description); if (error.json().errors[0].description) {
alert(error.json().errors[0].description);
} else {
this.cancelSubscriptions();
this.startSubscriptions();
}
} }
} }
} }
) )
; ;
};
private cancelSubscriptions() {
if(this.walletHistorySubscription) {
this.walletHistorySubscription.unsubscribe();
}
};
private startSubscriptions() {
this.getHistory();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment