first step of page abstraction.

This commit is contained in:
Bryce Covert
2020-08-16 17:40:45 -07:00
parent 0c87309c34
commit 001c66547c
10 changed files with 410 additions and 281 deletions

View File

@@ -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)]))])))