Refactor Network request to catch and display the error
The present fetch function is not configured for errors during API requests, leading to blank UI in case of a bad response.
Introduce a try catch block to display the error into a toast/alert in the web page.