Closed dprentis closed 6 years ago
hey! good catch! Please make a PR for that feature and also for a test.
PR here: https://github.com/josx/aor-feathers-client/pull/53
I needed to upgrade admin-on-rest, so updated to latest version. Seems version 1.0.1 used before, didn't handle flattening filters either.
Thanks for merging it! :) When are you planning the next release?
I think will be in the following days ;)
done!
Can't filter by nested properties, because query object is not flattened in restClient.js.
eg. when trying to filter
author.lastName='Brown'
, the query object becomes{ author: { lastName: 'Brown' } }
, which results in an invalid query string. I think it should be{ 'author.lastName': 'Brown' }
.Easy fix seems to be to import fetchUtils
import { fetchUtils } from 'admin-on-rest';
and then replaceObject.assign(query, params.filter);
here https://github.com/josx/aor-feathers-client/blob/master/src/restClient.js#L50 withObject.assign(query, fetchUtils.flattenObject(params.filter));