oliyh / re-graph

A graphql client for clojurescript and clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic querying not working

johnwesonga opened this issue · comments

I have this simple graphql call:

(re-frame/dispatch [::re-graph/init
                    {:http-url "https://api.spacex.land/graphql"
                     :ws-url nil
                      :http-parameters {:with-credentials? false}}])

(re-frame/dispatch [::re-graph/query
                    "{ launches { id, mission_name } }"  ;; your graphql query
                    [:events/add-launches]])

My event

(re-frame/reg-event-db
 :add-launches
 (fn [db [_ {:keys [data errors] :as payload}]]
   (-> db
       (assoc :data data :errors errors))))

This fails with:

core.cljs:3907 re-frame: expected a vector, but got:  ({:data {…}})
core.cljs:3919 re-frame: no :event handler registered for: undefined

I noticed that even if I remove the callback and just put dispatch to re-graph/query the error persists.

(re-frame/dispatch [::re-graph/query "{ launches { id, mission_name } }" nil])
Same error, any idea what is going on?