♻️ Move svg parsing into query rpc methods.

This commit is contained in:
Andrey Antukh 2021-04-13 16:29:38 +02:00 committed by Alonso Torres
parent 03a031091f
commit 7cc4873dd4
9 changed files with 65 additions and 94 deletions

View file

@ -378,7 +378,7 @@
(defn parse-svg
[[name text]]
(->> (rp/query! :parse-svg {:data text})
(->> (rp/query! :parsed-svg {:data text})
(rx/map #(assoc % :name name))))
(defn fetch-svg [name uri]

View file

@ -121,13 +121,11 @@
:response-type :blob})
(rx/mapcat handle-response)))
(defmethod query :parse-svg
[id {:keys [data] :as params}]
(defmethod query :parsed-svg
[id params]
(->> (http/send! {:method :post
:uri (u/join base-uri "api/svg/parse")
:headers {"content-type" "image/svg+xml"}
:body data
:response-type :text})
:uri (u/join base-uri "api/rpc/query/" (name id))
:body (http/transit-data params)})
(rx/map http/conditional-decode-transit)
(rx/mapcat handle-response)))