0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

Update delete image event acording to new image storage layout.

This commit is contained in:
Andrey Antukh 2016-10-04 21:10:00 +02:00
parent e017975162
commit b1ce61c6bb
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -239,19 +239,21 @@
;; --- Delete Images
(defrecord DeleteImage [coll-id image]
(defrecord DeleteImage [coll-id image-id]
rs/UpdateEvent
(-apply-update [_ state]
(update-in state [:image-colls-by-id coll-id :images] disj image))
(update state [:images-by-id] dissoc image-id))
rs/WatchEvent
(-apply-watch [_ state s]
(->> (rp/req :delete/image (:id image))
(->> (rp/req :delete/image image-id)
(rx/ignore))))
(defn delete-image
[coll-id image]
(DeleteImage. coll-id image))
[coll-id image-id]
{:pre [(uuid? coll-id)
(uuid? image-id)]}
(DeleteImage. coll-id image-id))
;; --- Remove Image