0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 17:00:36 -05:00

🐛 Fixed count projects in dashboard when deleting file

This commit is contained in:
alonso.torres 2020-12-07 16:45:18 +01:00 committed by Hirunatan
parent 621545cc74
commit 60e6dd7822

View file

@ -419,6 +419,8 @@
;; --- Delete File (by id)
(declare delete-file-result)
(defn delete-file
[{:keys [id project-id] :as params}]
(us/assert ::file params)
@ -431,8 +433,18 @@
ptk/WatchEvent
(watch [_ state s]
(->> (rp/mutation :delete-file {:id id})
(rx/ignore)))))
(let [team-id (uuid/uuid (get-in state [:route :path-params :team-id]))]
(->> (rp/mutation :delete-file {:id id})
(rx/map #(delete-file-result team-id project-id)))))))
(defn delete-file-result
[team-id project-id]
(ptk/reify ::delete-file
ptk/UpdateEvent
(update [_ state]
(-> state
(update-in [:projects team-id project-id :count] dec)))))
;; --- Rename File