mirror of
https://github.com/danbulant/Mangades
synced 2026-06-18 13:51:05 +00:00
better formatting
This commit is contained in:
parent
0d48ca6a1f
commit
7e2d9eb658
2 changed files with 17 additions and 11 deletions
|
|
@ -1,15 +1,9 @@
|
|||
<script>
|
||||
var name = "overlord";
|
||||
const base = "https://api.mangadex.org/";
|
||||
|
||||
function request(endpoint, query, type = "GET", body) {
|
||||
return fetch(base + endpoint + "?" + query, {
|
||||
method: type,
|
||||
body: body ? JSON.stringify(body) : undefined
|
||||
}).then(resp => resp.json());
|
||||
}
|
||||
import request from "./request";
|
||||
var name = "";
|
||||
|
||||
var result = request("manga", "title=" + name + "&contentRating[]=safe&contentRating[]=suggestive");
|
||||
$: result = request("manga", "title=" + name + "&contentRating[]=safe&contentRating[]=suggestive");
|
||||
result.then(console.log);
|
||||
</script>
|
||||
|
||||
|
|
@ -38,8 +32,10 @@
|
|||
<style>
|
||||
main
|
||||
{
|
||||
max-width: 720px;
|
||||
max-width: 450px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
10
src/request.js
Normal file
10
src/request.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const base = "https://api.mangadex.org/";
|
||||
|
||||
function request(endpoint, query, type = "GET", body) {
|
||||
return fetch(base + endpoint + "?" + query, {
|
||||
method: type,
|
||||
body: body ? JSON.stringify(body) : undefined
|
||||
}).then(resp => resp.json());
|
||||
}
|
||||
|
||||
export default request;
|
||||
Loading…
Reference in a new issue