saving clients pretty much works.
This commit is contained in:
@@ -30,8 +30,13 @@
|
||||
:query-obj {:venia/operation {:operation/type :mutation
|
||||
:operation/name "EditClient"}
|
||||
:venia/queries [{:query/data [:edit-client
|
||||
{:edit-client edited-client}
|
||||
[:id :name]
|
||||
{:edit-client
|
||||
;; TODO - hard code fields we want
|
||||
(-> edited-client
|
||||
(update :bank-accounts #(into % (map (fn [ba] (dissoc ba :is-new?)) (:new-bank-accounts edited-client))))
|
||||
(dissoc :new-bank-accounts))
|
||||
}
|
||||
[:id :name [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name]]]
|
||||
]}]}
|
||||
:on-success [::save-complete]
|
||||
:on-error [::save-error]}})))
|
||||
@@ -39,11 +44,12 @@
|
||||
(re-frame/reg-event-fx
|
||||
::save-complete
|
||||
(fn [{:keys [db]} [_ client]]
|
||||
(println client)
|
||||
{:dispatch [::events/modal-completed :auto-ap.views.pages.admin.clients/edit]
|
||||
:db (-> db
|
||||
|
||||
(assoc-in [:admin :client] nil)
|
||||
(assoc-in [:clients (:id client)] client))}))
|
||||
(assoc-in [:clients (:id (:edit-client client))] (:edit-client client)))}))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::save-error
|
||||
|
||||
Reference in New Issue
Block a user