Move media mutations to commands

This commit is contained in:
Andrey Antukh 2023-01-02 17:31:47 +01:00
parent 1718f49a90
commit 97a884018f
8 changed files with 427 additions and 260 deletions

View file

@ -93,7 +93,7 @@
(->> (rx/from uris)
(rx/filter (comp not svg-url?))
(rx/map prepare)
(rx/mapcat #(rp/mutation! :create-file-media-object-from-url %))
(rx/mapcat #(rp/command! :create-file-media-object-from-url %))
(rx/do on-image))
(->> (rx/from uris)

View file

@ -466,9 +466,10 @@
{:name (extract-name uri)
:url uri}))))
(rx/mapcat (fn [uri-data]
(->> (rp/mutation! (if (contains? uri-data :content)
:upload-file-media-object
:create-file-media-object-from-url) uri-data)
(->> (rp/command! (if (contains? uri-data :content)
:upload-file-media-object
:create-file-media-object-from-url)
uri-data)
;; When the image uploaded fail we skip the shape
;; returning `nil` will afterward not create the shape.
(rx/catch #(rx/of nil))