Allow CORS backend option and fix frontend to allow it

This commit is contained in:
alonso.torres 2021-10-20 11:09:30 +02:00
parent f32f13069f
commit 007728819b
9 changed files with 80 additions and 18 deletions

View file

@ -9,6 +9,8 @@
(:require
[app.common.transit :as t]
[app.common.uuid :as uuid]
[app.util.globals :refer [global]]
[app.util.object :as obj]
[beicon.core :as rx]))
(declare handle-response)
@ -28,11 +30,13 @@
data (t/encode-str message)
instance (:instance worker)]
(.postMessage instance data)
(->> (:stream worker)
(rx/filter #(= (:reply-to %) sender-id))
(take-messages)
(rx/map handle-response)))))
(if (some? instance)
(do (.postMessage instance data)
(->> (:stream worker)
(rx/filter #(= (:reply-to %) sender-id))
(take-messages)
(rx/map handle-response)))
(rx/empty)))))
(defn ask!
[worker message]
@ -79,6 +83,11 @@
(.addEventListener instance "message" handle-message)
(.addEventListener instance "error" handle-error)
(ask! worker
{:cmd :configure
:params
{"penpotPublicURI" (obj/get global "penpotPublicURI")}})
worker))
(defn- handle-response