aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tau
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-20 00:46:13 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-20 00:55:09 +0100
commitd85306e3fa2a25bcace91565bbc9bfabd8e3796c (patch)
tree0b3640ff5d95a774ea702d36a92030d64492c195 /src/frontend/tau
parent0dd14a00d40ddb3426f2222e57f141c30a273238 (diff)
feat: Add request helper for re-frame-http-fx
Diffstat (limited to 'src/frontend/tau')
-rw-r--r--src/frontend/tau/api.cljs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/frontend/tau/api.cljs b/src/frontend/tau/api.cljs
new file mode 100644
index 0000000..e69bc9c
--- /dev/null
+++ b/src/frontend/tau/api.cljs
@@ -0,0 +1,15 @@
+(ns tau.api
+ (:require
+ [ajax.core :as ajax]))
+
+(defn get-request
+ ([uri on-success on-failure]
+ (get-request uri on-success on-failure {}))
+ ([uri on-success on-failure params]
+ {:http-xhrio {:method :get
+ :uri uri
+ :params params
+ :format (ajax/json-request-format)
+ :response-format (ajax/json-response-format {:keywords? true})
+ :on-success on-success
+ :on-failure on-failure}}))