Fixed external call to GraphQL
authorLaurent Wouters <lwouters@cenotelie.fr>
Thu, 21 Jun 2018 18:00:18 +0200
changeset 2 9bf18ded95ce
parent 1 3fc6832162c2
child 3 b7a2348c2378
Fixed external call to GraphQL
cubicweb_graphql/views.py
--- a/cubicweb_graphql/views.py	Thu Jun 21 17:39:47 2018 +0200
+++ b/cubicweb_graphql/views.py	Thu Jun 21 18:00:18 2018 +0200
@@ -18,9 +18,13 @@
 """cubicweb-graphql views/forms/actions/components for web ui"""
 
 from cubicweb.web.views.ajaxcontroller import ajaxfunc
+from querier import GraphQLQuerier, format_execution_result
+
 
 @ajaxfunc(output_type='json')
 def graphql(self):
-    req = self._cw
-    query = req.form.get('query')
-    return self._cw.execute_graphql(query)
\ No newline at end of file
+    query = self._cw.form.get('query')
+    cnx = self._cw.cnx
+    results = GraphQLQuerier.execute(cnx, query)
+    results = format_execution_result(results)
+    return results