zonemaster-gui-preact/static/scripts/api.js
Gaël Berthaud-Müller 0374cacd75 first commit
2024-02-13 18:53:37 +01:00

16 lines
440 B
JavaScript

const API_URL = 'https://zonemaster.fr/api';
export function rpcApi(method, params = {}) {
return fetch(API_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
id: Math.round(Math.random() * 1e10),
jsonrpc: "2.0",
method: method,
params: params
})
}).then(response => response.json())
}