Skip to content

Commit

Permalink
Renamed shadowed variable, removed useless argument and factorize cases
Browse files Browse the repository at this point in the history
  • Loading branch information
pemoreau committed Oct 10, 2019
1 parent 7975de5 commit 291ba32
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions packages/ra-data-graphql-simple/src/buildVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const prepareParams = (params, queryType, introspectionResults) => {
return;
}

result[key] = castType(param, arg.type, introspectionResults.types);
result[key] = castType(param, arg.type);
});

return result;
Expand All @@ -115,8 +115,8 @@ const buildGetListVariables = introspectionResults => (

if (filterSome) {
const filter = Object.keys(params.filter[key]).reduce(
(acc, k) => ({
...acc,
(filter_acc, k) => ({
...filter_acc,
[`${k}_in`]: params.filter[key][k],
}),
{}
Expand Down Expand Up @@ -185,7 +185,7 @@ const buildGetListVariables = introspectionResults => (
};
};

const buildCreateUpdateVariables = () => (
const buildCreateUpdateVariables = (
resource,
aorFetchType,
params,
Expand Down Expand Up @@ -256,28 +256,18 @@ export default introspectionResults => (
};
}
case GET_ONE:
case DELETE:
return {
id: preparedParams.id,
};
case CREATE:
case UPDATE: {
return buildCreateUpdateVariables(introspectionResults)(
resource,
aorFetchType,
preparedParams,
queryType
);
}
case CREATE: {
return buildCreateUpdateVariables(introspectionResults)(
return buildCreateUpdateVariables(
resource,
aorFetchType,
preparedParams,
queryType
);
}
case DELETE:
return {
id: preparedParams.id,
};
}
};

0 comments on commit 291ba32

Please sign in to comment.