ability to approve

This commit is contained in:
Bryce Covert
2017-12-09 08:26:52 -08:00
parent 36cac4a023
commit bc6db905a5
6 changed files with 59 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
(:require [re-frame.core :as re-frame]
[auto-ap.db :as db]
[auto-ap.routes :as routes]
[bidi.bidi :as bidi]))
(re-frame/reg-event-db
@@ -20,6 +21,19 @@
(fn [db [_ new-invoices]]
(assoc-in db [:invoices] new-invoices)))
(re-frame/reg-event-db
::invoices-approved
(fn [db [_ new-invoices]]
(assoc-in db [:invoices :pending] new-invoices)))
(re-frame/reg-event-fx
::approve-invoices
(fn [cofx [_]]
{:http {:method :post
:uri "/api/invoices/approve"
:on-success ::invoices-approved
}}))
(re-frame/reg-event-db
::received-invoices
(fn [db [_ type new-invoices]]