Mangades/src/util/request.js
2021-06-07 22:38:22 +02:00

11 lines
No EOL
396 B
JavaScript

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