first step of page abstraction.
This commit is contained in:
@@ -37,6 +37,16 @@
|
||||
:else
|
||||
[]))
|
||||
|
||||
(defn disabled-for [which]
|
||||
(cond (= :loading (:state which))
|
||||
true
|
||||
|
||||
(= :error (:state which))
|
||||
false
|
||||
|
||||
:else
|
||||
false))
|
||||
|
||||
|
||||
(re-frame/reg-sub
|
||||
::multi
|
||||
@@ -92,3 +102,16 @@
|
||||
(fn [db [_ single error]]
|
||||
(assoc db single {:state :error
|
||||
:error error})))
|
||||
|
||||
(defn status-notification [{:keys [statuses]}]
|
||||
(let [states
|
||||
(->> statuses
|
||||
(mapv #(deref (re-frame/subscribe %)))
|
||||
(filter #(= :error (:state %))))]
|
||||
(when (seq states)
|
||||
[:div.notification
|
||||
(for [state states
|
||||
state (:error state)]
|
||||
(do
|
||||
^{:key (:message state)}
|
||||
[:p (:message state)]))])))
|
||||
|
||||
Reference in New Issue
Block a user