Remove paths on click
This commit is contained in:
parent
5f6ff4fe9d
commit
b21b83c182
|
@ -81,3 +81,10 @@
|
|||
(fn [db [_ paths]]
|
||||
(localstorage/save! "app-db-paths" paths)
|
||||
(assoc-in db [:app-db :paths] paths)))
|
||||
|
||||
(rf/reg-event-db
|
||||
:app-db/remove-path
|
||||
(fn [db [_ path]]
|
||||
(let [new-db (update-in db [:app-db :paths] disj path)]
|
||||
(localstorage/save! "app-db-paths" (get-in new-db [:app-db :paths]))
|
||||
new-db)))
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
[:div.subtree
|
||||
[subtree
|
||||
(get-in @data path)
|
||||
[:button.subtree-button {:on-click #(swap! subtree-paths disj path)}
|
||||
[:button.subtree-button {:on-click #(rf/dispatch [:app-db/remove-path path])}
|
||||
[:span.subtree-button-string
|
||||
(str path)]]]]])
|
||||
@subtree-paths))]
|
||||
|
|
Loading…
Reference in New Issue