1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 10:43:39 +02:00

Fix all the "unregistered effects handler for :event" errors, closes #25

This commit is contained in:
Arne Schlüter 2018-10-10 15:39:28 +02:00
commit 563cab9099
3 changed files with 31 additions and 36 deletions

View file

@ -24,13 +24,13 @@
(defn good-api-response
"Handles when the server responded. There could still be an error while
processing the request on the server side which we have to account for."
[fx [_ endpoint params response]]
(let [response-cache (cons :db (cache-path endpoint params))]
[{:keys [db]} [_ endpoint params response]]
(let [response-cache (cache-path endpoint params)]
(try
(assoc-in fx response-cache (api/unwrap-response response))
{:db (assoc-in db response-cache (api/unwrap-response response))}
(catch ExceptionInfo e
{:dispatch [:notification/show :error (api/error-msg e)]
:db (update-in fx response-cache dissoc :api/is-loading?)}))))
:db (update-in db response-cache dissoc :api/is-loading?)}))))
(reg-event-fx :api/good-response good-api-response)