adding new invoices.
This commit is contained in:
@@ -52,6 +52,21 @@
|
||||
:uri "/api/invoices/reject"
|
||||
:on-success [::received-invoices :pending]
|
||||
}}))
|
||||
(re-frame/reg-event-db
|
||||
::submitted-new-invoice
|
||||
(fn [db [_ invoice]]
|
||||
(assoc db :new-invoice {})))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::submit-new-invoice
|
||||
(fn [{:keys [db]} [_ invoice]]
|
||||
|
||||
{:http {:method :post
|
||||
:uri "/api/invoices"
|
||||
:body (pr-str {:rows [(assoc invoice :imported true)]})
|
||||
:headers {"Content-Type" "application/edn"}
|
||||
:on-success [::submitted-new-invoice]}
|
||||
:db (assoc-in db [:new-invoice :loading?] true)}))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::received-invoices
|
||||
@@ -60,3 +75,8 @@
|
||||
(assoc-in [:invoices type] new-invoices)
|
||||
(assoc-in [:status :loading] false)
|
||||
)))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::change-form-state
|
||||
(fn [db [_ target value]]
|
||||
(assoc-in db target value)))
|
||||
|
||||
Reference in New Issue
Block a user