Last active
April 20, 2018 06:23
-
-
Save janherich/8ea1cff5dd7e79acf6ac034003d24c05 to your computer and use it in GitHub Desktop.
Extension - events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; examples of public functions provided by us | |
(defn add-http-request [{:keys [url method payload]}] | |
(fn [_] | |
{:http {:method method | |
:url url | |
:payload payload}})) | |
(defn set-in [{:keys [path value]}] | |
(fn [_] | |
{:db (set-in db path value)})) | |
{:status/add-http-request add-http-request | |
:status/set-in set-in} | |
;; hypotetical usage | |
:views/my-component | |
[button {:on-press #event [::send-transaction [:status/add-http-request {:url "/transactions" | |
:method "post" | |
:payload "test"}] | |
[:status/set-in {:path [:extension :sent] | |
:value true}]]} | |
"Click me!"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@janherich What's
send-transaction
in this context and how does it manipulates bothadd-http-request
andset-in
?