0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49: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 ;; --- Delete Images
(defrecord DeleteImage [coll-id image] (defrecord DeleteImage [coll-id image-id]
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-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 rs/WatchEvent
(-apply-watch [_ state s] (-apply-watch [_ state s]
(->> (rp/req :delete/image (:id image)) (->> (rp/req :delete/image image-id)
(rx/ignore)))) (rx/ignore))))
(defn delete-image (defn delete-image
[coll-id image] [coll-id image-id]
(DeleteImage. coll-id image)) {:pre [(uuid? coll-id)
(uuid? image-id)]}
(DeleteImage. coll-id image-id))
;; --- Remove Image ;; --- Remove Image