From 44b40020eedd006fd025e267fb95d7bdad14c678 Mon Sep 17 00:00:00 2001 From: Max Schridde Date: Tue, 1 Oct 2019 13:07:33 -0700 Subject: [PATCH] run make prettier --- .../src/buildVariables.js | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/packages/ra-data-graphql-simple/src/buildVariables.js b/packages/ra-data-graphql-simple/src/buildVariables.js index d0a710b90e1..3565883f678 100644 --- a/packages/ra-data-graphql-simple/src/buildVariables.js +++ b/packages/ra-data-graphql-simple/src/buildVariables.js @@ -100,7 +100,7 @@ const buildGetListVariables = introspectionResults => ( aorFetchType, params ) => { - let variables = { filter: { } }; + let variables = { filter: {} }; if (params.filter) { variables.filter = Object.keys(params.filter).reduce((acc, key) => { if (key === 'ids') { @@ -152,10 +152,15 @@ const buildGetListVariables = introspectionResults => ( f => f.name === parts[0] ); const type = getFinalType(resourceField.type); - return { ...acc, [key]: sanitizeValue(type, params.filter[key]) }; + return { + ...acc, + [key]: sanitizeValue(type, params.filter[key]), + }; } - const resourceField = resource.type.fields.find(f => f.name === key); + const resourceField = resource.type.fields.find( + f => f.name === key + ); if (resourceField) { const type = getFinalType(resourceField.type); @@ -172,24 +177,27 @@ const buildGetListVariables = introspectionResults => ( }; } - return { ...acc, [key]: sanitizeValue(type, params.filter[key]) }; + return { + ...acc, + [key]: sanitizeValue(type, params.filter[key]), + }; } return { ...acc, [key]: params.filter[key] }; - }, {}) + }, {}); } - + if (params.pagination) { - variables.page = parseInt(params.pagination.page, 10) - 1 - variables.perPage = parseInt(params.pagination.perPage, 10) + variables.page = parseInt(params.pagination.page, 10) - 1; + variables.perPage = parseInt(params.pagination.perPage, 10); } - - if (params.sort){ - variables.sortField = params.sort.field - variables.sortOrder = params.sort.order + + if (params.sort) { + variables.sortField = params.sort.field; + variables.sortOrder = params.sort.order; } - return variables + return variables; }; const buildCreateUpdateVariables = () => (