This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-21
Channels
- # aleph (7)
- # beginners (79)
- # calva (1)
- # cider (5)
- # clj-kondo (12)
- # clojure (7)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-chicago (1)
- # clojure-europe (2)
- # clojure-seattle (4)
- # clojurescript (68)
- # data-science (1)
- # datavis (1)
- # figwheel-main (2)
- # hoplon (2)
- # juxt (1)
- # leiningen (3)
- # luminus (8)
- # off-topic (65)
- # onyx (1)
- # pathom (12)
- # reagent (6)
- # reitit (3)
- # shadow-cljs (7)
- # spacemacs (5)
I'm still trying to make the pathom-viz query editor a standalone app. I notice that the simple-parser-demo
card expects a local Pathom parser, but I already have a http server listening for Pathom queries, so I'm trying to make the requests to the server.
I think I should update this:
https://github.com/wilkerlucio/pathom-viz/blob/abb4006be4181ebf4c803a1e07edbe4a8ff790c1/src/core/com/wsscode/pathom/viz/workspaces.cljs#L31-L34
to make http requests, but I'm lost, not sure how. Any suggestions?
hello @jlle, from the snippet you sent I'm remembering that the query runner uses a different remote name, that's this pv.query-editor/remote-key
, did you tried settings this remote to be your remote?
@wilkerlucio you mean something like
:networking
{pv.query-editor/remote-key
(p.network/pathom-remote "")}
?close, but you have to use the regular fulcro network if you want to use the standard HTTP remote, the pathom-remote
is a wrapper to turn local async parsers in remotes
oh, sorry, I just realized it will require some more effort to wrap the http call
there is a problem in the current implementation, you actually have to use an async parser interface to use the network it provides
but its not so bad, you can wrap the remote with a parser interface, which is: [env tx] => channel
let me try to get a demo, that will help updating the docs also
or, do a fetch call from the parser interface
@jlle something like this:
(defn transit-read [x]
(-> (transit/read (transit/reader :json) x)))
(defn transit-write [x]
(-> (transit/write (transit/writer :json) x)))
(defn http-request-parser [url]
(fn [env tx]
(go-catch
(let [{::p.http/keys [body]}
(<? (p.http/request {::p.http/driver p.http.fetch/request-async
::p.http/url url
::p.http/content-type ::p.http/transit+json
::p.http/method ::p.http/post
::p.http/headers {}
::p.http/form-params (transit-write tx)}))]
(transit-read body)))))
; networking
:networking
{pv.query-editor/remote-key
(p.network/pathom-remote
(pv.query-editor/client-card-parser (http-request-parser "")))}
@wilkerlucio thanks, it looks better, I see that pathom queries are done to the server 🙂 For some reason the results are not displayed on the card. But I can see the proper response on the chrome devtools network tab. I don't have time now, but I'll try to debug it later