Package Exports
- @jodaz_/data-provider
- @jodaz_/data-provider/lib/esm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jodaz_/data-provider) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ra-laravel-client
A laravel-focused JSONAPI dataprovider for react-admin. This package is still in development. Currently only supports:
getListgetManygetManyReferencegetOnecreateupdatedeleteget: Custom wrapper for axios.get() methodpost: Custom wrapper for axios.post() method
Usage
- Install the package
npm i -D ra-laravel-client. - Import and set the base url, and pass it as the dataprovider for react-admin.
//in app.js
import React from "react";
import { Admin, Resource } from "react-admin";
import apiClient from "ra-laravel-client";
const dataProvider = apiClient('http://dev.project.loc/api');
const App = () => (
<Admin dashboard={Dashboard} dataProvider={dataProvider}>
...
</Admin>
);
export default App;API
apiClient(api, customConfigs, tokenName);api: a valid API route REQUIRED.customConfigs: an object of custom axios configs.tokenName: a valid token name used when retrieving a Bearer token from localStorage.
Other custom configs
"offsetPageNum": numberan offset for page counter
Credits
I must give a huge thanks to @henvo. I literally copy-pasted his original repo and adapted to my own codebase.