zonemaster-gui-preact/static/scripts/api.js

17 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())
}