flare / static /js /common.js
ciyidogan's picture
Upload 6 files
dbc8392 verified
raw
history blame
485 Bytes
const apiBase = '';
function apiPost(path, body) {
return fetch(`${apiBase}${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
}).then(res => res.json());
}
function apiGet(path) {
return fetch(`${apiBase}${path}`)
.then(res => res.json());
}
function showResult(id, data) {
document.getElementById(id).innerText = data.message || JSON.stringify(data, null, 2);
}