add content type form

This commit is contained in:
Thomas Rubini 2023-04-01 18:19:56 +02:00
parent d5199a6ef1
commit 1cd238b4ab
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -17,6 +17,8 @@ async function makeAPIRequest(endpoint, body, options={}) {
if (options["content"] === 'json') {
fetchOptions["headers"]["Content-Type"] = 'application/json'
fetchOptions["body"] = JSON.stringify(body)
} else if (options["content"] === 'form') {
fetchOptions["body"] = body;
} else {
fetchOptions["body"] = new URLSearchParams(body);
}