Files
2026-05-07 21:57:47 +05:30

9 lines
297 B
JavaScript

export async function sendRequest(url, method, body) {
const res = await fetch(url, {
method,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
});
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
return res.json();
}