File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { createAction, handleActions } from 'redux-actions-helpers';
44export const startTransition = createAction ( '@@router/START_TRANSITION' , payload => ( { payload } ) ) ;
55export const resolved = createAction ( '@@router/RESOLVED' , payload => ( { payload } ) ) ;
66export const endTransition = createAction ( '@@router/END_TRANSITION' , payload => ( { payload } ) ) ;
7+ export const error = createAction ( '@@router/ERROR' , payload => ( { payload } ) ) ;
78
89// reducer
910const initialState = {
@@ -13,6 +14,7 @@ const initialState = {
1314 status : null ,
1415 params : null ,
1516 redirect : null ,
17+ error : null ,
1618 isTransition : false
1719} ;
1820export const reducer = handleActions ( {
@@ -33,6 +35,12 @@ export const reducer = handleActions({
3335 ...state ,
3436 ...payload
3537 }
38+ } ,
39+ [ error ] : ( state , { payload } ) => {
40+ return {
41+ ...state ,
42+ ...payload
43+ }
3644 }
3745} , { initialState } ) ;
3846
@@ -46,5 +54,8 @@ export const hookRedux = ({ dispatch }) => ({
4654 } ,
4755 render : ( ) => {
4856 dispatch ( endTransition ( { isTransition : false } ) ) ;
57+ } ,
58+ error : ( { error } ) => {
59+ dispatch ( error ( { error, isTransition : false } ) ) ;
4960 }
5061} ) ;
You can’t perform that action at this time.
0 commit comments