Procházet zdrojové kódy

redirect from /user to /user/login (#632)

Andreas Cederström před 8 roky
rodič
revize
5776750539
1 změnil soubory, kde provedl 6 přidání a 5 odebrání
  1. 6 5
      src/layouts/UserLayout.js

+ 6 - 5
src/layouts/UserLayout.js

@@ -1,5 +1,5 @@
 import React from 'react';
 import React from 'react';
-import { Link, Route } from 'dva/router';
+import { Link, Redirect, Switch, Route } from 'dva/router';
 import DocumentTitle from 'react-document-title';
 import DocumentTitle from 'react-document-title';
 import { Icon } from 'antd';
 import { Icon } from 'antd';
 import GlobalFooter from '../components/GlobalFooter';
 import GlobalFooter from '../components/GlobalFooter';
@@ -47,8 +47,8 @@ class UserLayout extends React.PureComponent {
             </div>
             </div>
             <div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
             <div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
           </div>
           </div>
-          {
-            getRoutes(match.path, routerData).map(item =>
+          <Switch>
+            {getRoutes(match.path, routerData).map(item =>
               (
               (
                 <Route
                 <Route
                   key={item.key}
                   key={item.key}
@@ -57,8 +57,9 @@ class UserLayout extends React.PureComponent {
                   exact={item.exact}
                   exact={item.exact}
                 />
                 />
               )
               )
-            )
-          }
+            )}
+            <Redirect exact from="/user" to="/user/login" />
+          </Switch>
           <GlobalFooter className={styles.footer} links={links} copyright={copyright} />
           <GlobalFooter className={styles.footer} links={links} copyright={copyright} />
         </div>
         </div>
       </DocumentTitle>
       </DocumentTitle>