|
|
@@ -9,30 +9,8 @@ import DashboardDesigner from '../components/dashboardDesigner/layout'
|
|
|
// 由于 antd 组件的默认文案是英文,所以需要修改为中文
|
|
|
import zhCN from 'antd/lib/locale-provider/zh_CN'
|
|
|
import Demo from '../demo';
|
|
|
-import Login from '../components/common/login';
|
|
|
|
|
|
-window.localStorage.setItem("isAuthenticated", "false");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-const PrivateRoute = ({ component: Component, ...rest }) => (
|
|
|
- <Route
|
|
|
- {...rest}
|
|
|
- render={props =>
|
|
|
- (window.localStorage.getItem("isAuthenticated") === "true"? true: false) ? (
|
|
|
- <Component {...props} />
|
|
|
- ) : (
|
|
|
- <Redirect
|
|
|
- to={{
|
|
|
- pathname: "/login",
|
|
|
- state: { from: props.location }
|
|
|
- }}
|
|
|
- />
|
|
|
- )
|
|
|
- }
|
|
|
- />
|
|
|
-);
|
|
|
+localStorage.setItem("isAuthenticated", "false");
|
|
|
|
|
|
function RouterConfig({ history }) {
|
|
|
return (
|
|
|
@@ -51,3 +29,21 @@ function RouterConfig({ history }) {
|
|
|
}
|
|
|
|
|
|
export default RouterConfig;
|
|
|
+
|
|
|
+const PrivateRoute = ({ component: Component, ...rest }) => (
|
|
|
+ <Route
|
|
|
+ {...rest}
|
|
|
+ render={props =>
|
|
|
+ (window.localStorage.getItem("isAuthenticated") === "true"? true: false) ? (
|
|
|
+ <Component {...props} />
|
|
|
+ ) : (
|
|
|
+ <Redirect
|
|
|
+ to={{
|
|
|
+ pathname: "/login",
|
|
|
+ state: { from: props.location }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }
|
|
|
+ />
|
|
|
+);
|