0.7.4 • Published 3 years ago

@specter/redux-effects-specter v0.7.4

Weekly downloads
36
License
MIT
Repository
github
Last release
3 years ago

redux-effects-specter

specter binding for redux-effects family.

Installation

npm install --save redux-effects-specter

Usage

Installing the middleware:

import { createStore, applyMiddleware } from 'redux';
import { Client } from '@specter/specter';
import stepsMiddleware from 'redux-effects-steps';
import specterMiddleware from '@specter/redux-effects-specter';
import rootReducer from './reducers';

const client = new Client({
  base: '/xhr'
});

const store = createStore(
  rootReducer,
  applyMiddleware(
    stepsMiddleware,
    fetchrMiddleware(fetchr)
  )
);

Defining action creators:

import { createAction } from 'redux-actions';
import { steps } from 'redux-effects-steps';
import { specterRead } from '@specter/redux-effects-specter';

const fetchUserRequest = createAction('FETCH_USER_REQUEST');
const fetchUserSuccess = createAction('FETCH_USER_SUCCESS');
const fetchUserFail = createAction('FETCH_USER_FAIL');

function fetchUser(user) {
  return steps(
    fetchUserRequest(),
    specterRead('users', { user }),
    [fetchUserSuccess, fetchUserFail]
  );
}

API (Action Creators)

specterCreate

  • types
(service: string, options: { query?: object; body?: object; headers?: object } = {}): Promise

specterUpdate

  • types
(service: string, options: { query?: object; body?: object; headers?: object } = {}): Promise

specterDelete

  • types
(service: string, options: { query?: object; headers?: object } = {}): Promise

specterRead

  • types
(service: string, options: { query?: object; headers?: object } = {}): Promise
0.7.4

3 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.6.5

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.0

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.19

4 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago