thedesk/app/js/common/api.js

17 lines
410 B
JavaScript
Raw Normal View History

2020-07-10 15:16:39 +10:00
async function getJson(start) {
let json = {}
let response = null
response = await fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json'
}
})
if (!response.ok) {
response.text().then(function (text) {
setLog(response.url, response.status, text)
})
}
json = await response.json()
return json
}