index.js 1.11 KB
Newer Older
dengxiaofeng's avatar
dengxiaofeng committed
1 2 3
import React from 'react';
import { Helmet } from 'react-helmet';
import { renderRoutes } from 'react-router-config';
张烨's avatar
张烨 committed
4
import { BrowserRouter as Router, Switch } from 'react-router-dom';
5
import { appConnector } from './store';
张烨's avatar
张烨 committed
6 7 8
import Authozed from '@/utils/authority';
import UserLogin from '@/pages/user/login';
import UserLayout from '@/layouts/UserLayout';
张烨's avatar
张烨 committed
9
import { AUTHORITY, BASENAME } from '@/utils/constants';
10
import { PictureWallProvider } from '@/components/Upload/context';
11
export default appConnector(function App(props) {
12
  const { routesConfig } = props;
dengxiaofeng's avatar
dengxiaofeng committed
13 14
  return (
    <>
张烨's avatar
张烨 committed
15
      <Helmet titleTemplate="%s - 运维平台" defaultTitle="运维平台">
dengxiaofeng's avatar
dengxiaofeng committed
16
        <meta name="description" content="运维平台" />
dengxiaofeng's avatar
dengxiaofeng committed
17
      </Helmet>
18 19 20 21 22 23 24 25 26
      <Router basename={BASENAME}>
        <Authozed
          noMatch={
            <UserLayout>
              <UserLogin />
            </UserLayout>
          }
          authority={[AUTHORITY.LOGIN]}
        >
27 28 29
          <PictureWallProvider>
            <Switch>{renderRoutes(routesConfig.routes)}</Switch>
          </PictureWallProvider>
30 31
        </Authozed>
      </Router>
dengxiaofeng's avatar
dengxiaofeng committed
32 33
    </>
  );
34
});