added support

This commit is contained in:
Bryce Covert
2018-04-30 21:20:29 -07:00
parent 5ab67c5887
commit 9b95b5b5f2
5 changed files with 74 additions and 0 deletions

View File

@@ -86,6 +86,21 @@
(assoc-in db (concat [:admin :vendor] path)
value)))
(re-frame/reg-event-db
::add-relationship
(fn [db [_ ]]
(-> db
(update-in [:admin :vendor :relationships] #(conj (or % [])
{:account-number (get-in db [:admin :vendor :new-relationship-account-number])
:company-id (get-in db [:admin :vendor :new-relationship-company])}))
(update-in [:admin :vendor] dissoc :new-relationship-account-number :new-relationship-company))))
(re-frame/reg-event-db
::remove-relationship
(fn [db [_ i]]
(-> db
(update-in [:admin :vendor :relationships] #(vec (concat (subvec % 0 i) (subvec % (min (count %) (inc i)))))))))
(re-frame/reg-event-fx
::mounted
(fn [{:keys [db]} _]