Data provider for integration react admin and league fractal
Currently these actions are supported:
# via npmnpm install jsonapi-league-fractal# via yarnyarn add jsonapi-league-fractal
Import this package, set the base url and pass it as the dataProvider to react-admin.
//in app.js;;;const dataProvider = ;const App =<Admin dashboard=Dashboard dataProvider=dataProvider>...</Admin>;;
This client allows you to set some optional settings as the second parameter:
// Configure some settings.const settings = ... ;// Pass it as the second parameter after the base URL.const dataProvider = ;
Custom HTTP headers
Custom headers can be set by providing a
headers object in
const settings =headers:Authorization: 'Bearer ...''X-Requested-With': 'XMLHttpRequest'
The default value is:
Accept: 'application/vnd.api+json; charset=utf-8''Content-Type': 'application/vnd.api+json; charset=utf-8'
This client assumes that you are using an authProvider for your react-admin application. In order to use authentication with your backend your authProvider needs to store credentials in localStorage.
For basic auth your authProvider needs to store username and password like this:
For authentication via (access) token your authProvider needs to store the token like this:
Update method (PUT vs. PATCH)
First versions used
PUT as the default update HTTP method.
In version 0.5.0 this was changed to
PATCH since it complies with the
JSONAPI standard.. You can still use
PUT by declaring the update method in
// Set the update method from PATCH to PUT.updateMethod: 'PUT'
Array format for
This package makes usage of the aweseome
qs querystring parsing library.