index.js 606 Bytes
Newer Older
zhanghaozhe committed
1
import React from 'react'
zhanghaozhe committed
2
import { Switch, Route } from 'react-router-dom'
zhanghaozhe committed
3
import RouterConfig from './router-config'
4
import PrivateRoute from './privateRoute'
zhanghaozhe committed
5 6 7 8


export default function () {
    return (
zhanghaozhe committed
9 10 11 12 13 14 15 16 17 18 19 20
        <Switch>
            {RouterConfig.map((item, index) => {
                let {isPrivate, ...rest} = item
                if (isPrivate) {
                    return <PrivateRoute {...rest} key={index}/>
                } else {
                    return (
                        <Route {...rest} key={index}/>
                    )
                }
            })}
        </Switch>
zhanghaozhe committed
21 22
    )
}