@springtree/eva-sdk-redux-store-builder
TypeScript icon, indicating that this package has built-in type declarations

6.1.15 • Public • Published

@springtree/eva-sdk-redux-store-builder

This library provides the functionality to create a Redux store for the EVA backend. It will add some basic feature like endpoint selection and current user support. Please the SDK documentation for how to add services and your own logic to your store.

Usage

import { ReducersMapObject } from 'redux';
import { Logic } from 'redux-logic';
import { bootstrapEndpoint } from '@springtree/eva-sdk-core-service';
import {
  StoreBuilder,
  IEvaReduxStoreDefaultShape,
  createCurrentUserTokenAction,
} from '@springtree/eva-sdk-redux-store-builder';

const url = 'https://api.eva-dev.on-eva.io';

// Declare your redux store extensions
//
export interface IMyReduxStore extends IEvaReduxStoreDefaultShape {
  // TODO: Add your state properties
}

const reducers: ReducersMapObject<Partial<IMyReduxStore>> = {
  // TODO: Add your state reducers
};

const logics: Logic[] = [
  // TODO: Add your state effects logic
];

// Create the default EVA redux store which contains current user support
// out-of-the-box
//
const builder = new StoreBuilder<IMyReduxStore>();
const store = builder.createStore({
  reducers,
  logics,
  initialState: { endpointUrl: url },
});

// (Optional) Create an RxJs observable for the store state
//
const store$ = createStoreObservable(store);

Dependencies (9)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @springtree/eva-sdk-redux-store-builder

    Weekly Downloads

    269

    Version

    6.1.15

    License

    UNLICENSED

    Unpacked Size

    330 kB

    Total Files

    183

    Last publish

    Collaborators

    • mdoeswijk
    • janvandenberg
    • adebree
    • appie
    • springtree_solutions