Skip to content

Commit 75c5396

Browse files
committed
add resolve action back for backward compatibility
1 parent dbacb37 commit 75c5396

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/index.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { createAction, handleActions } from 'redux-actions-helpers';
22

33
// actions
44
export const start = createAction('@@router/START', payload => ({ payload }));
5+
// TODO: remove this action in future
6+
export const resolve = createAction('@@router/RESOLVE', payload => ({ payload }));
57
export const end = createAction('@@router/END', payload => ({ payload }));
68
export const error = createAction('@@router/ERROR', payload => ({ payload }));
79
export const cancel = createAction('@@router/CANCEL');
@@ -18,19 +20,7 @@ const initialState = {
1820
isTransition: false
1921
};
2022
export 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

Comments
 (0)