Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Pass Playground params as data attributes
Marcin Gębala8116932d299b
diff --git a/templates/graphql/playground.html b/templates/graphql/playground.htmlindex 679354c65b..c089ea1b86 100644--- a/templates/graphql/playground.html+++ b/templates/graphql/playground.html@@ -9,7 +9,7 @@<script src="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/js/middleware.js"></script></head><body>- <div id="root">+ <div id="root" {% if api_url %}data-endpoint="{{ api_url }}"{% endif %} {% if query %}data-query="{{ query|safe }}"{% endif %}><style>body {background-color: rgb(23, 42, 58);@@ -44,20 +44,13 @@</div><script>window.addEventListener('load', function (event) {const settings = {- "schema.polling.enable": false,+ "schema.polling.enable": false};-- let tabs;- {% if api_url and query %}- tabs = [{- endpoint: "{{ api_url }}",- query: `{{ query|safe }}`- }]- {% endif %}-- GraphQLPlayground.init(document.getElementById('root'), {- settings, tabs- })+ const root = document.getElementById("root");+ const endpoint = root.dataset.endpoint;+ const query = root.dataset.query;+ const tabs = [{ endpoint, query }];+ GraphQLPlayground.init(root, { settings, tabs });})</script></body></html>