Short Notes on JS
From PaskvilWiki
Fetch Patterns
fetch("url", { options... })
.then((response) => {
if (!response.ok)
throw new Error('Network response was not ok');
return response.json(); // or response.blob(), etc.
})
.then((data) => {
// do something with the data received
})
.catch((error) => {
console.error('Failed to fetch:', error);
});