Fix to the :fetch-later issue

Thanks to @mdallastella@functional.cafe
This commit is contained in:
Simon Brooke 2018-07-27 18:22:36 +01:00
parent 17ebcbc782
commit 1098db3b47

View file

@ -203,23 +203,23 @@
db))))
(reg-event-db
(reg-event-fx
:process-locality
(fn
[db [_ response]]
[{db :db} [_ response]]
(js/console.log (str "Updating locality data: " (count response) " addresses " ))
;; loop to do it again
(dispatch [:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]}
{:ms 1000 :dispatch [:get-current-location]}]])
(refresh-map-pins)
(assoc
{:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]}
{:ms 1000 :dispatch [:get-current-location]}]
:db (assoc
(remove-from-feedback db :fetch-locality)
:addresses (js->clj response))))
:addresses (js->clj response))}))
(reg-event-db
(reg-event-fx
:bad-locality
(fn [db _]
(fn
[{db :db} [_ response]]
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
(js/console.log "Failed to fetch locality data")
;; loop to do it again