-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathRootRoute.js
67 lines (65 loc) · 2.98 KB
/
RootRoute.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
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
/* eslint-disable global-require */
import App from 'app/components/App';
import Benchmark from 'app/components/pages/Benchmark';
import WalletIndex from 'app/components/pages/WalletIndex';
import resolveRoute from './ResolveRoute';
// polyfill webpack require.ensure
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require);
export default {
path: '/',
component: App,
getChildRoutes(nextState, cb) {
const route = resolveRoute(nextState.location.pathname);
if (route.page === 'About') {
cb(null, [require('app/components/pages/About')]);
} else if (route.page === 'Welcome') {
cb(null, [require('app/components/pages/Welcome')]);
} else if (route.page === 'Faq') {
cb(null, [require('app/components/pages/Faq')]);
} else if (route.page === 'Login') {
cb(null, [require('app/components/pages/Login')]);
} else if (route.page === 'Privacy') {
cb(null, [require('app/components/pages/Privacy')]);
} else if (route.page === 'Support') {
cb(null, [require('app/components/pages/Support')]);
} else if (
route.page === 'XSSTest' &&
process.env.NODE_ENV === 'development'
) {
cb(null, [require('app/components/pages/XSS')]);
} else if (route.page === 'Benchmark') {
cb(null, [require('app/components/pages/Benchmark')]);
} else if (route.page === 'Tos') {
cb(null, [require('app/components/pages/Tos')]);
} else if (route.page === 'ChangePassword') {
cb(null, [require('app/components/pages/ChangePasswordPage')]);
} else if (route.page === 'CreateAccount') {
cb(null, [require('app/components/pages/CreateAccount')]);
} else if (route.page === 'Approval') {
cb(null, [require('app/components/pages/Approval')]);
} else if (route.page === 'RecoverAccountStep1') {
cb(null, [require('app/components/pages/RecoverAccountStep1')]);
} else if (route.page === 'RecoverAccountStep2') {
cb(null, [require('app/components/pages/RecoverAccountStep2')]);
} else if (route.page === 'Witnesses') {
cb(null, [require('app/components/pages/Witnesses')]);
} else if (route.page === 'Proposals') {
cb(null, [require('app/components/pages/Proposals')]);
} else if (route.page === 'UserProfile') {
cb(null, [require('app/components/pages/UserProfile')]);
} else if (route.page === 'Market') {
require.ensure([], require => {
cb(null, [require('app/components/pages/Market')]);
});
} else if (route.page === 'WalletIndex') {
cb(null, [WalletIndex]);
} else {
cb(process.env.BROWSER ? null : Error(404), [
require('app/components/pages/NotFound'),
]);
}
},
indexRoute: {
component: WalletIndex.component,
},
};