Merge pull request #8127 from tchak/fix-graphql-playground

fix(graphql): fix playground when admin has no procedures or dossiers
This commit is contained in:
Paul Chavard 2022-11-24 16:25:12 +01:00 committed by GitHub
commit aa5f11e077
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,15 +2,15 @@ class GraphqlController < ApplicationController
before_action :authenticate_administrateur!
def playground
procedure = current_administrateur.procedures.first
dossier = procedure.dossiers.first
procedure = current_administrateur.procedures&.first
dossier = procedure&.dossiers&.first
gon.default_query = API::V2::StoredQuery.get('ds-query-v2')
gon.default_variables = {
"demarcheNumber": procedure.id,
"dossierNumber": dossier.id,
"demarcheNumber": procedure&.id,
"dossierNumber": dossier&.id,
"includeDossiers": true
}.to_json
}.compact.to_json
render :playground, layout: false
end