From 1cd238b4ab6bca6320c7eebf20f479f2e06fea58 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Sat, 1 Apr 2023 18:19:56 +0200 Subject: [PATCH] add content type form --- truthinquiry/static/js/api.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/truthinquiry/static/js/api.js b/truthinquiry/static/js/api.js index b49f660..a55b5bc 100644 --- a/truthinquiry/static/js/api.js +++ b/truthinquiry/static/js/api.js @@ -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); }