@@ -15,7 +15,8 @@ const initialState = {
1515 params : { } ,
1616 redirect : null ,
1717 error : null ,
18- isTransition : false
18+ isTransition : false ,
19+ ctx : { }
1920} ;
2021export const reducer = handleActions ( {
2122 [ start + end + error ] : ( state , { payload } ) => {
@@ -31,17 +32,17 @@ export const reducer = handleActions({
3132
3233// hook
3334export const hookRedux = ( { dispatch, server } ) => ( {
34- start : ( { path, location } ) => {
35- dispatch ( start ( { path, location, isTransition : true } ) ) ;
35+ start : ( { path, location, ctx } ) => {
36+ dispatch ( start ( { path, location, isTransition : true , ctx . toObject ( ) } ) ) ;
3637 } ,
3738 resolve : ( { route, status, params, redirect } ) => {
38- server && dispatch ( end ( { route, status, params, redirect, isTransition : false } ) ) ;
39+ server && dispatch ( end ( { route, status, params, redirect, isTransition : false , ctx . toObject ( ) } ) ) ;
3940 } ,
4041 render : ( { route, status, params, redirect } ) => {
41- dispatch ( end ( { route, status, params, redirect, isTransition : false } ) ) ;
42+ dispatch ( end ( { route, status, params, redirect, isTransition : false , ctx . toObject ( ) } ) ) ;
4243 } ,
4344 error : ( { error : err } ) => {
44- dispatch ( error ( { err, isTransition : false } ) ) ;
45+ dispatch ( error ( { err, isTransition : false , ctx . toObject ( ) } ) ) ;
4546 } ,
4647 cancel : ( ) => {
4748 console . warn ( 'router cancel transition' ) ;
0 commit comments