0.7.4 • Published 4 years ago
@specter/redux-effects-specter v0.7.4
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
4 years ago
0.7.3
4 years ago
0.7.2
4 years ago
0.6.5
5 years ago
0.5.5
5 years ago
0.5.4
5 years ago
0.5.3
5 years ago
0.5.2
5 years ago
0.5.0
5 years ago
0.4.4
5 years ago
0.4.3
5 years ago
0.4.0
5 years ago
0.3.0
5 years ago
0.2.3
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.2.2
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago
0.0.27
5 years ago
0.0.26
5 years ago
0.0.23
5 years ago
0.0.24
5 years ago
0.0.22
6 years ago
0.0.21
6 years ago
0.0.19
6 years ago
0.0.18
6 years ago
0.0.17
6 years ago
0.0.16
6 years ago