-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
The ra-data-feather
provider can't be decorated (for extending or changing its behavior) the usual way (as the example in the react-admin
does).
The reason is that the ra-data-feather
provider returns a function instead of a JavaScript object with member methods.
That function needs to be wrapped by a decorator function:
import { UPDATE } from 'react-admin';
const addUploadCapabilities = function (dataProvider) {
return function(type, resource, params) {
// e.g. for "categories" resource and "UPDATE" type only:
if(resource === 'categories' && type === UPDATE) {
// extra stuff, modify `params`/`resource`
// [...]
// return [...]; // return to completely skip the `dataProvider` in this case
}
// call the underlying `ra-data-feathers` provider
return dataProvider(type, resource, params);
}
}
Metadata
Metadata
Assignees
Labels
No labels