summaryrefslogtreecommitdiff
path: root/static/src/assets
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2021-08-30 20:08:51 -0600
committerBrian Picciano <mediocregopher@gmail.com>2021-08-30 20:44:45 -0600
commit9343d2ea697f13e52e9199fce62a959f1954f580 (patch)
treee1e36e330a3c9891bfd8a625229a9b417ad89afa /static/src/assets
parent3e9a17abb9a9d63af3c260fba9dc404dd9c59ade (diff)
add chat handlers and only allow POST methods
Diffstat (limited to 'static/src/assets')
-rw-r--r--static/src/assets/api.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/static/src/assets/api.js b/static/src/assets/api.js
index b591764..7ce2e89 100644
--- a/static/src/assets/api.js
+++ b/static/src/assets/api.js
@@ -31,7 +31,7 @@ const doFetch = async (req) => {
// may throw
const solvePow = async () => {
- const res = await call('GET', '/api/pow/challenge');
+ const res = await call('/api/pow/challenge');
const worker = new Worker('/assets/solvePow.js');
@@ -46,8 +46,12 @@ const solvePow = async () => {
return {seed: res.seed, solution: powSol};
}
-const call = async (method, route, opts = {}) => {
- const { body = {}, requiresPow = false } = opts;
+const call = async (route, opts = {}) => {
+ const {
+ method = 'POST',
+ body = {},
+ requiresPow = false,
+ } = opts;
if (!utils.cookies["csrf_token"])
throw "csrf_token cookie not set, can't make api call";