Display an error message if status.cafe fails to be fetched

This commit is contained in:
Helen Chong 2024-06-09 15:20:32 +08:00
parent bd62e891ea
commit ec8cbb85c3
2 changed files with 4 additions and 2 deletions

View File

@ -29,6 +29,7 @@
document.getElementById("statuscafe-content").innerHTML = data.content; document.getElementById("statuscafe-content").innerHTML = data.content;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
document.getElementById("statuscafe-content").textContent = `[ERROR] ${error}`;
} }
}; };
fetchStatusCafe(); fetchStatusCafe();

View File

@ -3,7 +3,8 @@ date: 2024-06-09
--- ---
* Convert most of the images on this website to AVIF format to reduce file size and save bandwidth. * Convert most of the images on this website to AVIF format to reduce file size and save bandwidth.
* Improve status.cafe widget: * Improve my status.cafe widget:
* Write local JavaScript code to fetch data from status.cafe. * Write local JavaScript code to fetch data from status.cafe.
* Display a loading message before the status.cafe data is successfully fetched. * Display a loading message before the data fetch request is completed.
* Display an error message if the data fetching fails.
* Add a link to my status.cafe profile below the widget. * Add a link to my status.cafe profile below the widget.