@devgateway/dvz-ui-react
Version:
A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.
37 lines (36 loc) • 723 B
JavaScript
const h = (a, c, t = !1) => new Promise((o, i) => {
fetch(a, {
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
method: "POST",
body: JSON.stringify(c)
}).then(
function(n) {
n.status !== 200 && i(n), t && o(n.blob()), n.json().then(function(s) {
o(s);
}).catch(() => o(n.status));
}
).catch(function(n) {
i(n);
});
}), p = async (a, c = {}) => {
try {
const t = await fetch(a, {
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
});
if (!t.ok)
throw t;
return await t.json();
} catch (t) {
throw t;
}
};
export {
p as get,
h as post
};