Skip to content

Commit

Permalink
soyuka review
Browse files Browse the repository at this point in the history
  • Loading branch information
JF committed Jun 13, 2018
1 parent 6ec0ae7 commit 09ebf35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/hydra/addFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@ export default api => {

for (const resource of api.resources) {
let promise = fetchResource(resource.url).then(response => {
const resourceFilters = [];

if (response.filters) {
for (const filter of response.filters) {
let property = filter.property;
if (!response.filters) {
return [];
}

// TODO : To prevent PropertyFilter, maybe should be handle specifically ?
if (property === null) {
continue;
}
const resourceFilters = [];

const resourceFilter = new Filter(property, filter.variable);
for (const filter of response.filters) {
let property = filter.property;

resourceFilters.push(resourceFilter);
if (property === null) {
continue;
}

resourceFilters.push(new Filter(property, filter.variable));
}

return resourceFilters;
Expand Down
6 changes: 6 additions & 0 deletions src/hydra/parseHydraDocumentation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,9 @@ const resourceCollection = `{
{
"property": "id",
"variable": "id"
},
{
"variable": "test"
}
]
}
Expand All @@ -567,6 +570,9 @@ const filters = [
{
property: "id",
variable: "id"
},
{
variable: "test"
}
];

Expand Down

0 comments on commit 09ebf35

Please sign in to comment.