Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    redux-routed-api-middlewarepublic

    npm npm Dependency Status devDependency Status

    redux-routed-api-middleware

    Predictable fetch for redux. Used normalizr.

    $ npm install redux-routed-api-middleware --save
    // main-api.origins.js 
    import { ResourceOrigin, TransportJSON } from 'redux-routed-api-middleware';
     
     
     
    export const mainResource = ResourceOrigin({
      baseUrl: `${window.location.protocol}//${window.location.host}/api/`,
      defaultTransport: new TransportJSON()
    });
     
    // main-api.entities.js 
    import { schema } from 'redux-routed-api-middleware';
     
     
    export const EntitySandboxComponent = new schema.Entity('sandbox_component');
    // resource/components.js 
    import { EntitySandboxComponent } from '../main-api.entities';
    import { mainResource } from '../main-api.origins';
     
     
     
    export const resource = mainResource('/components', {}, { responseSchema: [ EntitySandboxComponent ] });
     
     
     
    export const getUiAllComponentsAction = resource('GET');

    install

    npm i redux-routed-api-middleware

    Downloadsweekly downloads

    2

    version

    2.3.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar