Roman Volosovskyi 0c69a27d95 unused aliases
2017-01-16 08:23:02 +02:00

18 lines
623 B
Clojure

(ns status-im.network.handlers
(:require [re-frame.core :refer [dispatch debug enrich after]]
[status-im.utils.handlers :refer [register-handler]]
[status-im.utils.handlers :as u]
[status-im.network.net-info :as ni]))
(register-handler :listen-to-network-status!
(u/side-effect!
(fn []
(let [handler #(dispatch [:update-network-status %])]
(ni/init handler)
(ni/add-listener handler)))))
(register-handler :update-network-status
(fn [db [_ is-connected?]]
(let [status (if is-connected? :online :offline)]
(assoc db :network-status status))))