@@ -2,6 +2,8 @@ import { createAction, handleActions } from 'redux-actions-helpers';
22
33// actions
44export const start = createAction ( '@@router/START' , payload => ( { payload } ) ) ;
5+ // TODO: remove this action in future
6+ export const resolve = createAction ( '@@router/RESOLVE' , payload => ( { payload } ) ) ;
57export const end = createAction ( '@@router/END' , payload => ( { payload } ) ) ;
68export const error = createAction ( '@@router/ERROR' , payload => ( { payload } ) ) ;
79export const cancel = createAction ( '@@router/CANCEL' ) ;
@@ -18,19 +20,7 @@ const initialState = {
1820 isTransition : false
1921} ;
2022export const reducer = handleActions ( {
21- [ start ] : ( state , { payload } ) => {
22- return {
23- ...state ,
24- ...payload
25- }
26- } ,
27- [ end ] : ( state , { payload } ) => {
28- return {
29- ...state ,
30- ...payload
31- }
32- } ,
33- [ error ] : ( state , { payload } ) => {
23+ [ start + resolve + end + error ] : ( state , { payload } ) => {
3424 return {
3525 ...state ,
3626 ...payload
@@ -46,8 +36,11 @@ export const hookRedux = ({ dispatch }) => ({
4636 start : ( { path, location } ) => {
4737 dispatch ( start ( { path, location, isTransition : true } ) ) ;
4838 } ,
49- render : ( { route, status, params, redirect } ) => {
50- dispatch ( end ( { route, status, params, redirect, isTransition : false } ) ) ;
39+ resolve : ( { route, status, params, redirect } ) => {
40+ dispatch ( resolve ( { route, status, params, redirect } ) ) ;
41+ } ,
42+ render : ( ) => {
43+ dispatch ( end ( { isTransition : false } ) ) ;
5144 } ,
5245 error : ( { error } ) => {
5346 dispatch ( error ( { error, isTransition : false } ) ) ;
0 commit comments