From 62a2aee9231b87bfb15efc26360a26c8f811e4d7 Mon Sep 17 00:00:00 2001 From: mfo Date: Tue, 23 Apr 2024 09:53:32 +0200 Subject: [PATCH] feat(api.playground): playground is accessible to anyone. allow user to fill in headers --- app/controllers/graphql_controller.rb | 9 +++------ app/javascript/entrypoints/playground.ts | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb index 5fc73618f..102b8c8fe 100644 --- a/app/controllers/graphql_controller.rb +++ b/app/controllers/graphql_controller.rb @@ -1,14 +1,11 @@ class GraphqlController < ApplicationController - before_action :authenticate_administrateur! - def playground - procedure = current_administrateur.procedures&.last - - gon.default_query = API::V2::StoredQuery.get('ds-query-v2') + procedure = current_administrateur&.procedures&.last gon.default_variables = { - "demarcheNumber": procedure&.id, + "demarcheNumber": procedure&.id || 42, "includeDossiers": true }.compact.to_json + gon.default_query = API::V2::StoredQuery.get('ds-query-v2') render :playground, layout: false end diff --git a/app/javascript/entrypoints/playground.ts b/app/javascript/entrypoints/playground.ts index 476c9989b..07d7a135c 100644 --- a/app/javascript/entrypoints/playground.ts +++ b/app/javascript/entrypoints/playground.ts @@ -24,8 +24,7 @@ function GraphiQLWithExplorer() { plugins: [explorer], query: query, variables: defaultVariables, - onEditQuery: setQuery, - isHeadersEditorEnabled: false + onEditQuery: setQuery }); }