diff --git a/src/uxbox/data/projects.cljs b/src/uxbox/data/projects.cljs index 49666b16a..5c8c4e3fa 100644 --- a/src/uxbox/data/projects.cljs +++ b/src/uxbox/data/projects.cljs @@ -34,6 +34,13 @@ (let [uuid (:id proj)] (update-in state [:projects-by-id] assoc uuid proj))) +(defn dissoc-project + "A reduce function for dissoc the project + from the state map." + [state proj] + (let [uuid (:id proj)] + (update-in state [:projects-by-id] dissoc uuid))) + (defn assoc-page "A reduce function for assoc the page to the state map." @@ -122,6 +129,17 @@ (-pr-writer [mv writer _] (-write writer "#"))))) +(defn delete-project + [proj] + (reify + rs/UpdateEvent + (-apply-update [_ state] + (dissoc-project state proj)) + + IPrintWithWriter + (-pr-writer [mv writer _] + (-write writer "#")))) + (defn go-to "A shortcut event that redirects the user to the first page of the project." diff --git a/src/uxbox/ui/dashboard/projects.cljs b/src/uxbox/ui/dashboard/projects.cljs index 34055ff9f..8e0ca6d9d 100644 --- a/src/uxbox/ui/dashboard/projects.cljs +++ b/src/uxbox/ui/dashboard/projects.cljs @@ -205,7 +205,7 @@ [:div.project-th-icon.delete {:on-click #(do (dom/stop-propagation %) - ;; (actions/delete-project conn uuid) + (rs/emit! (dp/delete-project project)) %)} i/trash]]])))