aboutsummaryrefslogtreecommitdiff
path: root/prediction/public
diff options
context:
space:
mode:
Diffstat (limited to 'prediction/public')
-rw-r--r--prediction/public/script.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/prediction/public/script.js b/prediction/public/script.js
index a4d0527..364789f 100644
--- a/prediction/public/script.js
+++ b/prediction/public/script.js
@@ -33,5 +33,7 @@ fetch("/auth/api/list?class=teacher")
submit.addEventListener("click", async (e) => {
const teacher = dropdown.value;
const body = JSON.stringify({ teacher });
- await fetch("api/set", { method, body, headers: { "Content-Type": "application/json" } });
+ const resp = await fetch("api/set", { method, body, headers: { "Content-Type": "application/json" } });
+ const res = await resp.json();
+ if (res.success) method = "PUT";
}); \ No newline at end of file