add user agent to requests

This commit is contained in:
Daniel Bulant 2023-10-14 19:21:10 +02:00
parent 4dcdaa3783
commit f5d7d2108b

View file

@ -11,6 +11,9 @@ export function getURL(endpoint, query) {
function request(endpoint, query, type = "GET", body) {
return fetch(getURL(endpoint, query), {
method: type,
headers: typeof window === "undefined" ? {
"User-agent": "manga.danbulant.eu (discord @techmandancz)"
} : undefined,
body: body ? JSON.stringify(body) : undefined
}).then(resp => resp.json());
}