diff --git a/dist/index.js b/dist/index.js index 1c152b9..a97799c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1 +1 @@ -import{jsx}from"react/jsx-runtime";import{useLocation,Switch,Route,Redirect}from"react-router-dom";var __assign=function(){return(__assign=Object.assign||function(t){for(var r,e=1,o=arguments.length;e; - auth?: boolean; exact?: boolean; routes?: Array | undefined; } interface RouterViewProps { routes: Array; - onEnter: (to: string, next: Function) => void; + /** + * Require a function to call before routing. + * @param to Pathname of user's destination. + * @param next Function to allow rendering. + * @usage Read more at [github](https://github.com/syy11cn/config-router/blob/main/README.md). + */ + onEnter: (to: string, next: (path?: string) => void) => void; } declare const RouterView: FunctionComponent; diff --git a/src/index.tsx b/src/index.tsx index e055231..a23ff19 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,7 +10,7 @@ interface RouterViewProps { * @param next Function to allow rendering. * @usage Read more at [github](https://github.com/syy11cn/config-router/blob/main/README.md). */ - onEnter: (to: string, next: Function) => void; + onEnter: (to: string, next: (path?: string) => void) => void; } const RouterView: FunctionComponent = ({