We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44c7355 commit 2752e29Copy full SHA for 2752e29
src/Router/index.js
@@ -484,6 +484,25 @@ const registerListener = () => {
484
}
485
})
486
487
+
488
+/**
489
+ * Navigate to root hash
490
+ */
491
+const root = () => {
492
+ const rootHash = getRootHash()
493
+ if (isString(rootHash)) {
494
+ navigate(rootHash)
495
+ } else if (isFunction(rootHash)) {
496
+ rootHash().then(res => {
497
+ if (isObject(res)) {
498
+ navigate(res.path, res.params)
499
+ } else {
500
+ navigate(res)
501
+ }
502
+ })
503
504
+}
505
506
// export API
507
export default {
508
startRouter,
@@ -512,6 +531,7 @@ export default {
512
531
App: RoutedApp,
513
532
// keep backwards compatible
514
533
focusPage: restoreFocus,
534
+ root: root,
515
535
/**
516
536
* Deprecated api methods
517
537
*/
0 commit comments