feat(api.playground): playground is accessible to anyone. allow user to fill in headers

This commit is contained in:
mfo 2024-04-23 09:53:32 +02:00
parent cd0c891c16
commit 62a2aee923
2 changed files with 4 additions and 8 deletions

View file

@ -1,14 +1,11 @@
class GraphqlController < ApplicationController class GraphqlController < ApplicationController
before_action :authenticate_administrateur!
def playground def playground
procedure = current_administrateur.procedures&.last procedure = current_administrateur&.procedures&.last
gon.default_query = API::V2::StoredQuery.get('ds-query-v2')
gon.default_variables = { gon.default_variables = {
"demarcheNumber": procedure&.id, "demarcheNumber": procedure&.id || 42,
"includeDossiers": true "includeDossiers": true
}.compact.to_json }.compact.to_json
gon.default_query = API::V2::StoredQuery.get('ds-query-v2')
render :playground, layout: false render :playground, layout: false
end end

View file

@ -24,8 +24,7 @@ function GraphiQLWithExplorer() {
plugins: [explorer], plugins: [explorer],
query: query, query: query,
variables: defaultVariables, variables: defaultVariables,
onEditQuery: setQuery, onEditQuery: setQuery
isHeadersEditorEnabled: false
}); });
} }