better formatting

This commit is contained in:
AAA1exa8 2021-05-20 16:19:43 +02:00
parent 0d48ca6a1f
commit 7e2d9eb658
2 changed files with 17 additions and 11 deletions

View file

@ -1,15 +1,9 @@
<script> <script>
var name = "overlord"; import request from "./request";
const base = "https://api.mangadex.org/"; var name = "";
function request(endpoint, query, type = "GET", body) {
return fetch(base + endpoint + "?" + query, {
method: type,
body: body ? JSON.stringify(body) : undefined
}).then(resp => resp.json());
}
var result = request("manga", "title=" + name + "&contentRating[]=safe&contentRating[]=suggestive"); var result = request("manga", "title=" + name + "&contentRating[]=safe&contentRating[]=suggestive");
$: result = request("manga", "title=" + name + "&contentRating[]=safe&contentRating[]=suggestive");
result.then(console.log); result.then(console.log);
</script> </script>
@ -38,8 +32,10 @@
<style> <style>
main main
{ {
max-width: 720px; max-width: 450px;
margin: auto; margin: auto;
} }
input {
width: 100%;
}
</style> </style>

10
src/request.js Normal file
View 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;