returned try catch

This commit is contained in:
ishak jmilou.ishak
2024-12-18 12:36:38 +01:00
parent f0b87de63d
commit 29cfa86b5f

View File

@@ -24,11 +24,15 @@ document.querySelectorAll(".btn").forEach(button => {
// Fetch data from the server
async function fetchData() {
try{
const response = await fetch("/data");
const data = await response.json();
return data;
} catch (error) {
console.error("Error:", error);
}
// Parse the data and show it on the website
async function parseData() {
const data = await fetchData();