Makes yodlee edit work again

This commit is contained in:
Bryce
2023-08-10 22:04:05 -07:00
parent e2e43534d7
commit a8ce1c1ed7
6 changed files with 2524 additions and 2431 deletions

View File

@@ -14,7 +14,8 @@
[bidi.bidi :as bidi]
[config.core :refer [env]]
[datomic.api :as dc]
[hiccup2.core :as hiccup]))
[hiccup2.core :as hiccup]
[auto-ap.datomic :refer [pull-attr]]))
(def default-read '[:db/id
:yodlee-provider-account/last-updated
@@ -47,6 +48,35 @@ fastlink.open({fastLinkURL: '%s',
]
[:div]))))
(defn reauthenticate [{:keys [session form-params]}]
(html-response
(com/modal
{}
(com/modal-card
{}
[:div.flex [:div.p-2 "Yodlee Fastlink"] ]
[:div
[:div#fa-spot]
[:script {:lang "text/javascript"}
(hiccup/raw
(format "
fastlink.open({fastLinkURL: '%s',
accessToken: '%s',
params: {'configName': 'Aggregation',
'providerAccountId': %d,
'flow': 'edit'}},
'fa-spot');
"
(:yodlee2-fastlink env)
(yodlee/get-access-token (-> (pull-attr (dc/db conn)
{:yodlee-provider-account/client [:client/code]}
(Long/parseLong (get form-params "id")))
:yodlee-provider-account/client
:client/code))
(pull-attr (dc/db conn) :yodlee-provider-account/id (Long/parseLong (get form-params "id")))))]]
[:div]))))
(def grid-page {:id "yodlee-table"
:nav (com/company-aside-nav)
:id-fn :db/id
@@ -71,7 +101,13 @@ fastlink.open({fastLinkURL: '%s',
(com/button-icon {} svg/refresh)
"Link new account")])
:row-buttons (fn [user e]
[(when (is-admin? user)
[
(com/button {:hx-put (bidi/path-for ssr-routes/only-routes
:company-yodlee-provider-account-reauthenticate)
:color :primary
:hx-target "#modal-holder"}
"Reauthenticate")
(when (is-admin? user)
(com/icon-button {:hx-put (bidi/path-for ssr-routes/only-routes
:company-yodlee-provider-account-refresh)
:hx-target "closest tr"}