mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 04:46:11 +02:00
Use doto idiom for populate formdata object.
This commit is contained in:
parent
0c0d227788
commit
a6d15e11ef
1 changed files with 4 additions and 6 deletions
|
@ -47,14 +47,12 @@
|
||||||
|
|
||||||
(defmethod request :create/image
|
(defmethod request :create/image
|
||||||
[_ {:keys [coll id files] :as body}]
|
[_ {:keys [coll id files] :as body}]
|
||||||
(let [build-body (fn []
|
(let [body (doto (js/FormData.)
|
||||||
(let [data (js/FormData.)]
|
(.append "file" (aget files 0))
|
||||||
(.append data "file" (aget files 0))
|
(.append "id" id))
|
||||||
(.append data "id" id)
|
|
||||||
data))
|
|
||||||
params {:url (str url "/library/images/" coll)
|
params {:url (str url "/library/images/" coll)
|
||||||
:method :post
|
:method :post
|
||||||
:body (build-body)}]
|
:body body}]
|
||||||
(send! params)))
|
(send! params)))
|
||||||
|
|
||||||
(defmethod request :delete/image
|
(defmethod request :delete/image
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue