Skip to content

Commit

Permalink
Merge pull request #3358 from CSCfi/fix-blacklist-component
Browse files Browse the repository at this point in the history
fix: bad fetch in top level blacklist after action
  • Loading branch information
Macroz authored Nov 25, 2024
2 parents 8fc45cf + 6f4098d commit e0efd95
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/cljs/rems/administration/blacklist.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns rems.administration.blacklist
"Implements both a blacklist component and the blacklist-page"
(:require [re-frame.core :as rf]
(:require [medley.core :refer [assoc-some]]
[re-frame.core :as rf]
[rems.administration.administration :as administration]
[rems.administration.components :refer [perform-action-button]]
[rems.common.application-util]
Expand Down Expand Up @@ -31,7 +32,9 @@
{:url-params params
:handler #(rf/dispatch [::fetch-result %])
:error-handler (flash-message/default-error-handler :top description)}))
{:db (assoc db ::loading? true)}))
{:db (assoc db
::loading? true
::resource (:resource params))}))

(rf/reg-event-fx
::add-to-blacklist
Expand All @@ -45,7 +48,7 @@
:top
description
(fn []
(rf/dispatch [::fetch-blacklist {:resource (:resource/ext-id resource)}])
(rf/dispatch [::fetch-blacklist (assoc-some {} :resource (::resource db))])
(rf/dispatch [::set-validation-errors nil])
(rf/dispatch [::set-selected-user nil])
(rf/dispatch [::set-comment nil])))
Expand All @@ -63,7 +66,7 @@
:handler (flash-message/default-success-handler
:top
description
#(rf/dispatch [::fetch-blacklist {:resource (:resource/ext-id resource)}]))
#(rf/dispatch [::fetch-blacklist (assoc-some {} :resource (::resource db))]))
:error-handler (flash-message/default-error-handler :top description)}))
{}))

Expand Down

0 comments on commit e0efd95

Please sign in to comment.