From 5eb14d6d09638c9ba3f034a019a8cd54c512b238 Mon Sep 17 00:00:00 2001 From: LarsVomMars Date: Fri, 29 Jan 2021 11:31:24 +0100 Subject: Some fixes --- profile/public/script.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'profile/public/script.js') diff --git a/profile/public/script.js b/profile/public/script.js index eb5ff14..91b723e 100644 --- a/profile/public/script.js +++ b/profile/public/script.js @@ -92,18 +92,17 @@ form.addEventListener("submit", async (evt) => { } const body = JSON.stringify(rawBody); - const resp = await fetch("api/answer", { method, body }); + const resp = await fetch("api/answer", { method, body, headers: { "Content-Type": "application/json" } }); const res = await resp.json(); if (!res.success) alert("AHHHH"); else init = false; - // else location.reload(); // BUT WHY? }); saveBtn.addEventListener("click", (e) => { cropper.getCroppedCanvas() .toBlob(async (blob) => { const url = "api/answerImage"; - const method = imageInit ? "POST" : "PUT"; // Separate image init + const method = imageInit ? "POST" : "PUT"; const body = new FormData(); if (imageID === -1) { return; -- cgit v1.2.3