Created
August 18, 2016 10:58
-
-
Save Deraen/40ed55e8e257394a1a32c7613326fa7b to your computer and use it in GitHub Desktop.
Kekkonen + Re-frame
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
(reg-event-fx :get-current-party | |
(fn [{:keys [db]} _] | |
{:db (assoc db :loading? true) | |
:kekkonen {:query :api.party/get-current-party | |
;; called with the body | |
:on-success [:set-current-party] | |
;; or simple assoc-in? | |
:on-success [:assoc-in [:current-party]] | |
}})) | |
(reg-event :set-current-party | |
(fn [db [_ current-party]] | |
(assoc db :current-party current-party))) | |
(reg-event :assoc-in | |
(fn [db [_ ks v]] | |
(assoc-in db ks v))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment