Mangades/src/util/request.js
2021-05-21 15:00:33 +02:00

10 lines
No EOL
300 B
JavaScript

const base = "https://api.mangadex.org/";
function request(endpoint, query, type = "GET", body) {
return fetch(base + endpoint + (query ? "?" + query : ""), {
method: type,
body: body ? JSON.stringify(body) : undefined
}).then(resp => resp.json());
}
export default request;