Skip to content

Commit

Permalink
Add notify-on-seed effect
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Feb 10, 2025
1 parent 7b35c42 commit 0190c7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/com/yetanalytics/lrs_admin_ui/handlers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,19 @@
;; Api Key Management
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn- has-seed-cred?
[credentials]
(boolean (some (fn [cred] (when (:seed? cred) cred)) credentials)))

(re-frame/reg-event-fx
:credentials/notify-on-seed
global-interceptors
(fn [{:keys [db]} _]
(let [credentials (get db ::db/credentials)]
(if (has-seed-cred? credentials)
{:fx [[:dispatch [:notification/notify true "Seed credentials should be deleted!"]]]}
{}))))

(re-frame/reg-event-db
:credentials/set-credentials
global-interceptors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

(defn tenant []
(let [credentials @(subscribe [:db/get-credentials])]
;; FIXME: Apply notify-on-seed effect properly after re-route PR is merged
(when (not-empty credentials)
(dispatch [:credentials/notify-on-seed]))
[:div {:class "tenant-wrapper"}
[:div {:class "api-keys-table-actions"}
[:input {:type "button",
Expand Down

0 comments on commit 0190c7b

Please sign in to comment.