Commit 10a5a6b2 authored by dev0tion's avatar dev0tion

Cancel subscriptions on API disconnect

parent ca3eb31e
...@@ -65,6 +65,7 @@ export class DashboardComponent implements OnInit { ...@@ -65,6 +65,7 @@ export class DashboardComponent implements OnInit {
error => { error => {
console.log(error); console.log(error);
if (error.status === 0) { if (error.status === 0) {
this.cancelSubscriptions();
alert("Something went wrong while connecting to the API. Please restart the application."); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) { } else if (error.status >= 400) {
if (!error.json().errors[0]) { if (!error.json().errors[0]) {
...@@ -101,6 +102,7 @@ export class DashboardComponent implements OnInit { ...@@ -101,6 +102,7 @@ export class DashboardComponent implements OnInit {
error => { error => {
console.log(error); console.log(error);
if (error.status === 0) { if (error.status === 0) {
this.cancelSubscriptions();
alert("Something went wrong while connecting to the API. Please restart the application."); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) { } else if (error.status >= 400) {
if (!error.json().errors[0]) { if (!error.json().errors[0]) {
......
...@@ -57,6 +57,7 @@ export class HistoryComponent { ...@@ -57,6 +57,7 @@ export class HistoryComponent {
error => { error => {
console.log(error); console.log(error);
if (error.status === 0) { if (error.status === 0) {
this.cancelSubscriptions();
alert("Something went wrong while connecting to the API. Please restart the application."); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) { } else if (error.status >= 400) {
if (!error.json().errors[0]) { if (!error.json().errors[0]) {
......
...@@ -60,6 +60,7 @@ export class StatusBarComponent implements OnInit { ...@@ -60,6 +60,7 @@ export class StatusBarComponent implements OnInit {
error => { error => {
console.log(error); console.log(error);
if (error.status === 0) { if (error.status === 0) {
this.cancelSubscriptions();
alert("Something went wrong while connecting to the API. Please restart the application."); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) { } else if (error.status >= 400) {
if (!error.json().errors[0]) { if (!error.json().errors[0]) {
......
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