How to use ra-data-simple-rest - 3 common examples

To help you get started, we’ve selected a few ra-data-simple-rest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marmelab / react-admin / examples / demo / src / dataProvider / rest.js View on Github external
import simpleRestProvider from 'ra-data-simple-rest';

const restProvider = simpleRestProvider('http://localhost:4000');

const delayedDataProvider = new Proxy(restProvider, {
    get: (target, name, self) =>
        name === 'then' // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method
            ? self
            : (resource, params) =>
                  new Promise(resolve =>
                      setTimeout(
                          () => resolve(restProvider[name](resource, params)),
                          500
                      )
                  ),
});

export default delayedDataProvider;
github bootstrap-styled / ra-ui / examples / demo / src / dataProvider / rest.js View on Github external
import simpleRestProvider from 'ra-data-simple-rest';

const restProvider = simpleRestProvider('http://localhost:4000');
export default (type, resource, params) =>
    new Promise(resolve =>
        setTimeout(() => resolve(restProvider(type, resource, params)), 500)
    );
github Kirk-Wang / Blog / react-admin-demo / src / App.tsx View on Github external
import { englishMessages } from "./i18n/en";
import { chineseMessages } from "./i18n/cn";
import { fakeServer } from "./fakeServer";
import { CustomerList, CustomerEdit, CustomerCreate, CustomerIcon } from "./customers";
import { CommandList, CommandIcon, CommandEdit } from "./commands";
import { ProductList, ProductCreate, ProductEdit, ProductIcon } from "./products";
import { Segments, SegmentsIcon } from "./segments";
import { CategoryList, CategoryIcon, CategoryEdit } from "./categories";
import { ReviewIcon, ReviewList, ReviewEdit } from "./reviews";
import { Menu } from "./Menu";
import { customRoutes } from "./routes";
import { sagas } from "./sagas";
import { themeReducer } from "./themeReducer";
import { AppLayout } from "./Layout";

const dataProvider = simpleRestProvider("http://api.fakeserver.com");

const messages = {
    cn: chineseMessages,
    en: englishMessages,
};

const i18nProvider = (locale: string) => messages[locale];

export class App extends React.Component {
    public componentWillMount() {
        fakeServer();
    }

    public render() {
        return (

ra-data-simple-rest

Simple REST data provider for react-admin

MIT
Latest version published 15 days ago

Package Health Score

95 / 100
Full package analysis

Popular ra-data-simple-rest functions

Similar packages