This commit is contained in:
BC
2018-10-25 20:30:26 -07:00
parent 2b3898f444
commit 8478011b8c
2 changed files with 23 additions and 1 deletions

View File

@@ -36,5 +36,11 @@
(let [[session token] (yodlee/get-access-token)]
{:status 200
:headers {"Content-Type" "application/edn"}
:body (pr-str (yodlee/get-accounts)) })))
:body (pr-str (yodlee/get-accounts)) }))
(POST "/accounts/:id" {:keys [query-params identity] {:keys [id]} :route-params :as request}
(assert-admin identity)
(let [[session token] (yodlee/get-access-token)]
{:status 200
:headers {"Content-Type" "application/edn"}
:body (pr-str (yodlee/update-yodlee (Long/parseLong id))) })))
wrap-secure))

View File

@@ -57,6 +57,18 @@
:on-success [::got-accounts]
:on-error [::save-error]}}))
(re-frame/reg-event-fx
::kick
(fn [{:keys [db]} [_ id]]
{:db (assoc-in db [::yodlee] {:accounts-loading? true})
:http {:token (:user db)
:method :post
:headers {"Content-Type" "application/edn"}
:uri (str "/api/yodlee/accounts/" id)
:on-success [::mounted]
:on-error [::save-error]}}))
(re-frame/reg-event-fx
::got-accounts
(fn [{:keys [db]} [_ accounts]]
@@ -108,7 +120,9 @@
[:th "Account Name"]
[:th "Account Number"]
[:th "Yodlee Account Number"]
[:th "Yodlee Last updated"]
[:th "Yodlee Status"]]]
(if @(re-frame/subscribe [::accounts-loading?])
[:tr [:td {:col-span "3"} "Loading..."]
]
@@ -117,7 +131,9 @@
[:td (:accountName account)]
[:td (:accountNumber account)]
[:td (:id account)]
[:td (str/join ", " (map :lastUpdated (:dataset account)))]
[:td (str/join ", " (map :additionalStatus (:dataset account)))]
[:td [:button.button.is-success {:on-click (dispatch-event [::kick (:id account)] )} "Kick." ]]
]))]])