Skip to content

Commit f533d9e

Browse files
committed
add location support
1 parent 92d2225 commit f533d9e

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"tsc": "tsc"
2323
},
2424
"devDependencies": {
25-
"typescript": "next"
25+
"typescript": "^2.1.4"
2626
},
2727
"dependencies": {
2828
"redux-actions-helpers": "1.x.x"

src/index.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const endTransition = createAction('@@router/END_TRANSITION', payload =>
77
// reducer
88
const initialState = {
99
path: null,
10+
location: null,
1011
route: null,
1112
status: null,
1213
params: null,
@@ -15,21 +16,25 @@ const initialState = {
1516
};
1617
export const reducer = handleActions({
1718
[startTransition]: (state, { payload }) => {
18-
// refactor: https://github.com/Microsoft/TypeScript/issues/2103
19-
return Object.assign({}, state, payload);
19+
return {
20+
...state,
21+
...payload
22+
}
2023
},
2124
[endTransition]: (state, { payload }) => {
22-
// refactor: https://github.com/Microsoft/TypeScript/issues/2103
23-
return Object.assign({}, state, payload);
25+
return {
26+
...state,
27+
...payload
28+
}
2429
}
2530
}, { initialState });
2631

2732
// hook
2833
export const hookRedux = ({ dispatch }) => ({
29-
start: ({ path }) => {
30-
dispatch(startTransition({ path }));
34+
start: ({ path, location }) => {
35+
dispatch(startTransition({ path, location }));
3136
},
32-
resolve: ({ path, route, status, params, redirect }) => {
33-
dispatch(endTransition({ path, route, status, params, redirect }));
37+
resolve: ({ route, status, params, redirect }) => {
38+
dispatch(endTransition({ route, status, params, redirect }));
3439
}
3540
});

yarn.lock

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
22
# yarn lockfile v1
3-
redux-actions-helpers:
3+
4+
5+
46
version "1.0.2"
57
resolved "https://registry.yarnpkg.com/redux-actions-helpers/-/redux-actions-helpers-1.0.2.tgz#6d9e1927cdf8d3184cded126a179a2b24d5a8934"
68

7-
typescript@next:
8-
version "2.1.0-dev.20161027"
9-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.0-dev.20161027.tgz#f6456102956dee194398fa1ad093b944c8db4f0a"
10-
9+
typescript@^2.1.4:
10+
version "2.1.4"
11+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.4.tgz#b53b69fb841126acb1dd4b397d21daba87572251"

0 commit comments

Comments
 (0)