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:
commit
aa5f11e077
1 changed files with 5 additions and 5 deletions
|
@ -2,15 +2,15 @@ class GraphqlController < ApplicationController
|
||||||
before_action :authenticate_administrateur!
|
before_action :authenticate_administrateur!
|
||||||
|
|
||||||
def playground
|
def playground
|
||||||
procedure = current_administrateur.procedures.first
|
procedure = current_administrateur.procedures&.first
|
||||||
dossier = procedure.dossiers.first
|
dossier = procedure&.dossiers&.first
|
||||||
|
|
||||||
gon.default_query = API::V2::StoredQuery.get('ds-query-v2')
|
gon.default_query = API::V2::StoredQuery.get('ds-query-v2')
|
||||||
gon.default_variables = {
|
gon.default_variables = {
|
||||||
"demarcheNumber": procedure.id,
|
"demarcheNumber": procedure&.id,
|
||||||
"dossierNumber": dossier.id,
|
"dossierNumber": dossier&.id,
|
||||||
"includeDossiers": true
|
"includeDossiers": true
|
||||||
}.to_json
|
}.compact.to_json
|
||||||
|
|
||||||
render :playground, layout: false
|
render :playground, layout: false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue