This commit is contained in:
sairaj mote 2023-04-15 16:47:44 +05:30
parent 464ec80c2a
commit 96f9ab3a1c

View File

@ -144,11 +144,13 @@
}
// fetch data and return json
async function fetchJson(url, options = {}) {
let response = await fetch(url, options)
const response = await fetch(url, options)
const json = await response.json()
if (response.ok) {
return await response.json()
return json
} else {
throw new Error(response.statusText)
console.error(json)
throw new Error(json.description)
}
}
function getFormattedTime(timestamp, format) {