not using namespaced keys, due to graphql

This commit is contained in:
Bryce Covert
2018-04-10 10:51:21 -07:00
parent 4a0275f024
commit 53905c317b
19 changed files with 114 additions and 109 deletions

View File

@@ -21,7 +21,7 @@
:token (:user db)
:body (pr-str edited-company)
:headers {"Content-Type" "application/edn"}
:uri (str "/api/companies/" (::entity/id edited-company))
:uri (str "/api/companies/" (:id edited-company))
:on-success [::save-complete]
:on-error [::save-error]}})))
@@ -31,7 +31,7 @@
(-> db
(assoc-in [:admin :company] nil)
(assoc-in [:companies (::entity/id company)] company))))
(assoc-in [:companies (:id company)] company))))
(re-frame/reg-event-db
::save-error

View File

@@ -26,12 +26,12 @@
(let [edited-vendor (get-in db [:admin :vendor])
fx {:db (assoc-in db [:admin :vendor :saving?] true)}]
(when (s/valid? ::entity/vendor edited-vendor)
(if (::entity/id edited-vendor)
(if (:id edited-vendor)
(assoc fx :http {:method :put
:token (:user db)
:body (pr-str edited-vendor)
:headers {"Content-Type" "application/edn"}
:uri (str "/api/vendors/" (::entity/id edited-vendor))
:uri (str "/api/vendors/" (:id edited-vendor))
:on-success [::save-complete]
:on-error [::save-error]})
(assoc fx :http {:method :post
@@ -48,7 +48,7 @@
(-> db
(assoc-in [:admin :vendor] nil)
(assoc-in [:vendors (::entity/id vendor)] vendor))))
(assoc-in [:vendors (:id vendor)] vendor))))
(re-frame/reg-event-db
::save-error
@@ -76,6 +76,6 @@
(fn [db [_ vendors]]
(assoc db :vendors (reduce (fn [vendors vendor]
(assoc vendors (::entity/id vendor) vendor))
(assoc vendors (:id vendor) vendor))
{}
vendors))))