0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-16 01:31:22 -05:00

Use doto idiom for populate formdata object.

This commit is contained in:
Andrey Antukh 2016-05-20 21:05:50 +03:00 committed by Jesús Espino
parent 0c0d227788
commit a6d15e11ef

View file

@ -47,14 +47,12 @@
(defmethod request :create/image
[_ {:keys [coll id files] :as body}]
(let [build-body (fn []
(let [data (js/FormData.)]
(.append data "file" (aget files 0))
(.append data "id" id)
data))
(let [body (doto (js/FormData.)
(.append "file" (aget files 0))
(.append "id" id))
params {:url (str url "/library/images/" coll)
:method :post
:body (build-body)}]
:body body}]
(send! params)))
(defmethod request :delete/image