diff --git a/package.json b/package.json index b941bf9..7628bba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@syy11cn/config-router", - "version": "1.0.1", + "version": "1.0.3", + "description": "A route rendering and route guarding lib.", "author": { "name": "Yiyang Sun", "email": "syy11cn@outlook.com" diff --git a/src/index.tsx b/src/index.tsx index c48cbbe..5494860 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -18,7 +18,7 @@ const RouterView: FunctionComponent = ({ let redirectPath: string = ''; let agreeToGo = true; - // Change state of `redirectPath` and `agreeToGo` + // Change state of `redirectPath` and `agreeToGo`. function next(path?: string) { agreeToGo = true; if (path) { @@ -32,43 +32,27 @@ const RouterView: FunctionComponent = ({ return ( {routes.map((route, index) => { - // If auth needed. - if (route.auth) { - // If `next()` called. - if (agreeToGo) { - // Need to redirect. - if (redirectPath) { - return ; - } else { - // OK to render. - return ( - ( - - )} - > - ); - } + // If `next()` called. + if (agreeToGo) { + // Need to redirect. + if (redirectPath) { + return ; + } else { + // OK to render. + return ( + ( + + )} + > + ); } - } else { - // No need for auth. - return ( - ( - - )} - > - ); } })} diff --git a/typings/routeType.ts b/typings/routeType.ts index e96171b..5df48eb 100644 --- a/typings/routeType.ts +++ b/typings/routeType.ts @@ -3,7 +3,6 @@ import * as React from 'react'; interface routeType { path: string; component: React.ComponentType; - auth?: boolean; exact?: boolean; routes?: Array | undefined; }