Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.42 KB

README.md

File metadata and controls

47 lines (30 loc) · 1.42 KB

npm npm Dependency Status devDependency Status

multi-routing-api

Predictable fetch for redux. Used normalizr.

$ npm install multi-routing-api --save
// main-api.origins.js
import { origin, TransportJSON } from 'multi-routing-api';



export const mainResource = origin({
  baseUrl: `${window.location.protocol}//${window.location.host}/api/`,
  transport: new TransportJSON()
});
// main-api.entities.js
import { schema } from 'multi-routing-api/lib/redux';


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');