you can check off individual invoices

This commit is contained in:
Bryce Covert
2018-05-10 21:30:50 -07:00
parent 5fb5b2d412
commit 7d5ae173f3
3 changed files with 176 additions and 161 deletions

View File

@@ -4,6 +4,7 @@
[auto-ap.entities.vendors :as vendor]
[auto-ap.events :as events]
[auto-ap.views.utils :refer [dispatch-event]]
[auto-ap.views.pages.check :as check]
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
[auto-ap.subs :as subs]
[auto-ap.events :as events]))
@@ -54,9 +55,16 @@
:body (pr-str {:invoice-ids (get-in db [::invoice-page :checked])})
:headers {"Content-Type" "application/edn"}
:uri (str "/api/checks/")
:on-success [::save-complete]
:on-success [::checks-created]
:on-error [::save-error]}}))
(re-frame/reg-event-fx
::checks-created
(fn [{:keys [db]} [_ data]]
{:dispatch [:auto-ap.events/set-active-page :check]
:db (-> db
(assoc ::check/checks data))}))
(re-frame/reg-event-fx
::invalidated
(fn [cofx [_ params]]