Skip to content

Commit

Permalink
Allow for custom route in pushTo and replaceTo methods (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
backflip authored and nkzawa committed Dec 17, 2016
1 parent e9543cf commit de6521a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/app.js
Original file line number Diff line number Diff line change
@@ -67,9 +67,19 @@ function propsToState (props) {
pathname: router.pathname,
back: () => router.back(),
push: (url) => router.push(route, url),
pushTo: (url) => router.push(null, url),
pushTo: (href, as) => {
const pushRoute = as ? href : null
const pushUrl = as || href

return router.push(pushRoute, pushUrl)
},
replace: (url) => router.replace(route, url),
replaceTo: (url) => router.replace(null, url)
replaceTo: (href, as) => {
const replaceRoute = as ? href : null
const replaceUrl = as || href

return router.replace(replaceRoute, replaceUrl)
}
}

return {

0 comments on commit de6521a

Please sign in to comment.