-
Notifications
You must be signed in to change notification settings - Fork 88
/
routes.js
37 lines (35 loc) · 912 Bytes
/
routes.js
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
import Application from "../pages/Application";
import User from "../pages/User";
import Repo from "../pages/Repo";
import rest from "../utils/rest";
const { actions } = rest;
export default function routes({ dispatch }) {
return {
path: "/",
component: Application,
indexRoute: {
path: "/",
onEnter(state, replaceState) {
replaceState(state, "/lexich");
}
},
childRoutes: [
{
path: "/:user",
component: User,
onEnter(state, replaceState, callback) {
const { user } = state.params;
dispatch(actions.userRepos({ user }, null, callback));
}
},
{
path: "/:user/:repo",
component: Repo,
onEnter(state, replaceState, callback) {
const { user, repo } = state.params;
dispatch(actions.repo({ user, repo }, null, callback));
}
}
]
};
}