forked from XimeX/usrspace-browser-addon
don't fetch data if offline
This commit is contained in:
parent
ad9abe3c94
commit
82bcdef199
|
@ -49,6 +49,9 @@ function fetchSpaceApi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchNewData() {
|
async function fetchNewData() {
|
||||||
|
if (!globalThis.navigator.onLine) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const result = await Promise.allSettled([fetchCalendar(), fetchSpaceApi()]);
|
const result = await Promise.allSettled([fetchCalendar(), fetchSpaceApi()]);
|
||||||
const calendarJson = result[0].value;
|
const calendarJson = result[0].value;
|
||||||
|
|
Loading…
Reference in a new issue