mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
🐛 Fixed count projects in dashboard when deleting file
This commit is contained in:
parent
621545cc74
commit
60e6dd7822
1 changed files with 14 additions and 2 deletions
|
@ -419,6 +419,8 @@
|
||||||
|
|
||||||
;; --- Delete File (by id)
|
;; --- Delete File (by id)
|
||||||
|
|
||||||
|
(declare delete-file-result)
|
||||||
|
|
||||||
(defn delete-file
|
(defn delete-file
|
||||||
[{:keys [id project-id] :as params}]
|
[{:keys [id project-id] :as params}]
|
||||||
(us/assert ::file params)
|
(us/assert ::file params)
|
||||||
|
@ -431,8 +433,18 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state s]
|
(watch [_ state s]
|
||||||
(->> (rp/mutation :delete-file {:id id})
|
(let [team-id (uuid/uuid (get-in state [:route :path-params :team-id]))]
|
||||||
(rx/ignore)))))
|
(->> (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
|
;; --- Rename File
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue