-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.ts
103 lines (100 loc) · 2.03 KB
/
routes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { RouteProps } from 'react-router-dom'
import Admin from './containers/Admin'
import Demo from './containers/Demo'
import Home from './containers/Home'
import Login from './containers/Login'
import Register from './containers/Register'
import User from './containers/User'
import OtherUser from './containers/OtherUser'
import SinglePlayer from './containers/SinglePlayer'
import NotFoundPage from './containers/NotFoundPage'
import LiveCenter from './containers/LiveCenter'
import Live from './containers/LiveCenter/Live'
import { Chat } from './components/Chat'
export enum PathName {
CHAT = '/chat',
OTHER_USER = '/user/:username',
_OTHER_USER = '/user',
USER = '/user',
LOGIN = '/login',
REGISTER = '/register',
DEMO = '/demo',
SINGLE_PLAYER = '/video',
NOT_FOUND_PAGE = '/404',
LIVE = '/live/:uid',
LIVE_CENTER = '/live',
HOME = '/',
ADMIN_ROOT = '/admin',
}
/* 集中存放所有路由配置 */
export const routes: RouteConfig[] = [
{
path: PathName.CHAT,
component: Chat,
},
{
path: PathName.LOGIN,
component: Login,
},
{
path: PathName.REGISTER,
component: Register,
},
{
path: PathName.OTHER_USER,
component: OtherUser,
},
{
path: PathName.USER,
component: User,
routeProps: {
exact: true,
},
},
{
path: PathName.DEMO,
component: Demo,
},
{
path: PathName.SINGLE_PLAYER,
component: SinglePlayer,
},
{
path: PathName.NOT_FOUND_PAGE,
component: NotFoundPage,
routeProps: {
exact: true,
},
},
{
path: PathName.LIVE,
component: Live,
},
{
path: PathName.LIVE_CENTER,
component: LiveCenter,
routeProps: {
exact: true,
},
},
{
path: PathName.ADMIN_ROOT,
component: Admin,
},
{
path: PathName.HOME,
component: Home,
routeProps: {
exact: true,
},
},
]
export interface RouteConfig {
/* 路由路径 */
path: string
/* 需要渲染的组件 */
component: any
/* 子路由 */
routes?: RouteConfig[]
routeProps?: RouteProps
}