Skip to content

Commit

Permalink
run make prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschridde1494 committed Oct 2, 2019
1 parent a096ab3 commit 44b4002
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions packages/ra-data-graphql-simple/src/buildVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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);
Expand All @@ -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 = () => (
Expand Down

0 comments on commit 44b4002

Please sign in to comment.