From d85306e3fa2a25bcace91565bbc9bfabd8e3796c Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Tue, 20 Dec 2022 00:46:13 +0100 Subject: feat: Add request helper for re-frame-http-fx --- src/frontend/tau/api.cljs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/frontend/tau/api.cljs (limited to 'src/frontend') 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}})) -- cgit v1.2.3