Skip to content

Commit b8b19f8

Browse files
committed
Use replace in onEnter and bump react-router
1 parent d4c3dc9 commit b8b19f8

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"react": "~0.14.3",
4747
"react-addons-test-utils": "^0.14.6",
4848
"react-redux": "^4.0.1",
49-
"react-router": "2.0.0-rc5",
49+
"react-router": "2.0.0",
5050
"react-router-redux": "~3.0.0",
5151
"redux": "^3.2.0"
5252
},

src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ const UserAuthWrapper = (args) => {
108108
}
109109

110110
wrapComponent.onEnter = (store, nextState, replace) => {
111-
const replaceWithState = ({ pathname, query }) => replace({ pathname, state: query })
112111
const authData = authSelector(store.getState())
113-
ensureAuth({ location: nextState.location, authData }, replaceWithState)
112+
ensureAuth({ location: nextState.location, authData }, replace)
114113
}
115114

116115
return wrapComponent

test/UserAuthWrapper-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,6 @@ describe('UserAuthWrapper', () => {
318318
expect(store.getState().routing.location.search).to.equal('')
319319
history.push('/onEnter')
320320
expect(store.getState().routing.location.pathname).to.equal('/login')
321-
expect(store.getState().routing.location.state).to.deep.equal({ redirect: '/onEnter' })
321+
expect(store.getState().routing.location.search).to.equal('?redirect=%2FonEnter')
322322
})
323323
})

0 commit comments

Comments
 (0)