can send emails on a whim

This commit is contained in:
Bryce Covert
2018-04-13 20:28:31 -07:00
parent c8e959bd40
commit 431c2883e2
9 changed files with 103 additions and 31 deletions

View File

@@ -42,6 +42,29 @@
:on-success [::save-complete]
:on-error [::save-error]}))))))
(re-frame/reg-event-fx
::remind
(fn [{:keys [db] :as fx} [_ id]]
{ :http {:method :post
:token (:user db)
:headers {"Content-Type" "application/edn"}
:uri (str "/api/vendors/" id "/remind")
:on-success [::reminder-sent]
:on-error [::failed "Failed to send reminder"]}
:db (assoc-in db [:admin :banner] nil)}))
(re-frame/reg-event-db
::reminder-sent
(fn [db [_ error]]
(-> db
(assoc-in [:admin :banner] "Reminder sent!"))))
(re-frame/reg-event-db
::failed
(fn [db [_ error]]
(-> db
(assoc-in [:admin :banner] error))))
(re-frame/reg-event-db
::save-complete
(fn [db [_ vendor]]