Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // replacing constants
- import {fetchTodos} from './actions'
- export default function(state = ..., action){
- switch(action.type){
- case fetchTodos.TYPE: // 'FETCH_TODOS@ASYNC_REQUEST'
- return ...
- case fetchTodos.success.TYPE: // 'FETCH_TODOS@ASYNC_SUCCESS'
- return ...
- casse fetchTodos.failure.TYPE: // 'FETCH_TODOS@ASYNC_FAILURE'
- return ...
- // used less, but are available...
- case fetchTodos.progress.TYPE:
- return ...
- case fetchTodos.cancel.TYPE:
- return ...
- }
- }
- // some where in your code
- import {fetchTodos} from './actions'
- fetchTodos()
- // ==> { type: 'FETCH_TODOS@ASYNC_REQUEST' }
- fetchTodos.success()
- // ==> { type: 'FETCH_TODOS@ASYNC_SUCCESS' }
- fetchTodos.failure()
- // ==> { type: 'FETCH_TODOS@ASYNC_FAILURE' }
- fetchTodos.progress()
- // ==> { type: 'FETCH_TODOS@ASYNC_PROGRESS' }
- fetchTodos.cancel()
- // ==> { type: 'FETCH_TODOS@ASYNC_CANCEL' }
Add Comment
Please, Sign In to add comment