Files
sigpro/dist/utils.js
natxocc afa2817118
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 3s
Update
2026-05-08 12:50:20 +02:00

25 lines
527 B
JavaScript

// src/utils.js
var db = async (url, data = {}, loading = null) => {
if (loading)
loading(true);
try {
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data),
credentials: "include"
});
if (!res.ok) {
const errorText = await res.text();
throw new Error(`Error ${res.status}: ${errorText}`);
}
return await res.json();
} finally {
if (loading)
loading(false);
}
};
export {
db
};