/handlers.cljs Secret
Created
January 15, 2018 23:15
Star
You must be signed in to star a gist
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 | |
:http/delete-contact! | |
(fn [{:keys [db]} [_ id]] | |
{:http-xhrio {:method :delete | |
:uri (str api-url "contacts/" id) | |
:timeout 5000 | |
:format (ajax/json-request-format) | |
:response-format (ajax/json-response-format) | |
:on-success [:http/delete-contact!--success id] | |
:on-failure [:http/set-error]}})) | |
(reg-event-db | |
:http/set-error | |
(fn [db [_ error]] | |
(assoc-in db ["state" "error"] error))) | |
;; This gets run but db is always empty. This is confirmed with (.log js/console (str db)). | |
;; Any assocs will assoc to nil. Is there anything obviously wrong that would cause this? | |
;; Response that triggers this is 204 No Content. db just doesn't seem to get passed in. | |
(reg-event-db | |
:http/delete-contact!--success | |
(fn [db [_ id]] | |
db)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment