Fix to the :fetch-later issue
Thanks to @mdallastella@functional.cafe
This commit is contained in:
parent
17ebcbc782
commit
1098db3b47
|
@ -203,23 +203,23 @@
|
||||||
db))))
|
db))))
|
||||||
|
|
||||||
|
|
||||||
(reg-event-db
|
(reg-event-fx
|
||||||
:process-locality
|
:process-locality
|
||||||
(fn
|
(fn
|
||||||
[db [_ response]]
|
[{db :db} [_ response]]
|
||||||
(js/console.log (str "Updating locality data: " (count response) " addresses " ))
|
(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)
|
(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)
|
(remove-from-feedback db :fetch-locality)
|
||||||
:addresses (js->clj response))))
|
:addresses (js->clj response))}))
|
||||||
|
|
||||||
|
|
||||||
(reg-event-db
|
(reg-event-fx
|
||||||
:bad-locality
|
:bad-locality
|
||||||
(fn [db _]
|
(fn
|
||||||
|
[{db :db} [_ response]]
|
||||||
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
|
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
|
||||||
(js/console.log "Failed to fetch locality data")
|
(js/console.log "Failed to fetch locality data")
|
||||||
;; loop to do it again
|
;; loop to do it again
|
||||||
|
|
Loading…
Reference in a new issue