Skip to content

Commit

Permalink
ajax formats added
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Sep 5, 2023
1 parent 35558c2 commit a3fce75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 13 additions & 1 deletion resources/ext/ajax.edn
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{:name "ajax"
{:name "cljs-ajax"
; build
:lazy false
:cljs-namespace [pinkgorilla.repl.cljs.ajax]
:cljs-ns-bindings {'ajax.core {'GET pinkgorilla.repl.cljs.ajax/http-get
'POST pinkgorilla.repl.cljs.ajax/http-post
'PUT pinkgorilla.repl.cljs.ajax/http-put
'DELETE pinkgorilla.repl.cljs.ajax/http-delete
; request/response formats
'json-request-format ajax.core/json-request-format
'json-response-format ajax.core/json-response-format
'transit-request-format ajax.core/transit-request-format
'transit-response-format ajax.core/transit-response-format
'ring-response-format ajax.core/ring-response-format
'url-request-format ajax.core/url-request-format
'text-request-format ajax.core/text-request-format
'text-response-format ajax.core/text-response-format
; There's no raw-request-format because it's handled by the DirectSubmission code
'raw-response-format ajax.core/raw-response-format
}}}
5 changes: 3 additions & 2 deletions src/pinkgorilla/repl/cljs/ajax.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
(:require
[promesa.core :as p]
[clojure.edn :as edn]
[ajax.core :refer [GET POST PUT]]
[ajax.core :refer [GET POST PUT DELETE]]
[clojure.string :as str]))

(defn- make-promise [AJAX-TYPE]
(defn make-promise [AJAX-TYPE]
([url]
(make-promise url {}))
([url params]
Expand All @@ -21,6 +21,7 @@
(def http-get (make-promise GET))
(def http-post (make-promise POST))
(def http-put (make-promise PUT))
(def http-delete (make-promise DELETE))



Expand Down

0 comments on commit a3fce75

Please sign in to comment.