Add proper catch for fetch errors
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

master
Garrett Mills 3 years ago
parent 562c31c947
commit 2fbf607707
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -61,8 +61,13 @@ export class ApiService {
}
public checkOnline(): Promise<boolean> {
return fetch(this.statUrl).then(resp => {
return resp && (resp.ok || resp.type === 'opaque');
return new Promise(res => {
fetch(this.statUrl).then(resp => {
res(resp && (resp.ok || resp.type === 'opaque'));
}).catch(e => {
console.error('Check Online Error', e);
res(false);
});
});
}

Loading…
Cancel
Save