1 import { IRouteProps } from 'inferno-router/dist/Route';
2 import { Main } from './components/main';
3 import { Login } from './components/login';
4 import { CreatePost } from './components/create-post';
5 import { CreateCommunity } from './components/create-community';
6 import { CreatePrivateMessage } from './components/create-private-message';
7 import { PasswordChange } from './components/password_change';
8 import { Post } from './components/post';
9 import { Community } from './components/community';
10 import { Communities } from './components/communities';
11 import { User } from './components/user';
12 import { Modlog } from './components/modlog';
13 import { Setup } from './components/setup';
14 import { AdminSettings } from './components/admin-settings';
15 import { Inbox } from './components/inbox';
16 import { Search } from './components/search';
17 import { Sponsors } from './components/sponsors';
18 import { Instances } from './components/instances';
20 interface IRoutePropsWithFetch extends IRouteProps {
21 fetchInitialData?(auth: string, path: string): Promise<any>[];
24 export const routes: IRoutePropsWithFetch[] = [
29 fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
32 path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
34 fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
36 { path: `/login`, component: Login },
39 component: CreatePost,
40 fetchInitialData: (auth, path) => CreatePost.fetchInitialData(auth, path),
43 path: `/create_community`,
44 component: CreateCommunity,
45 fetchInitialData: (auth, path) =>
46 CreateCommunity.fetchInitialData(auth, path),
49 path: `/create_private_message/recipient/:recipient_id`,
50 component: CreatePrivateMessage,
51 fetchInitialData: (auth, path) =>
52 CreatePrivateMessage.fetchInitialData(auth, path),
55 path: `/communities/page/:page`,
56 component: Communities,
57 fetchInitialData: (auth, path) => Communities.fetchInitialData(auth, path),
61 component: Communities,
62 fetchInitialData: (auth, path) => Communities.fetchInitialData(auth, path),
65 path: `/post/:id/comment/:comment_id`,
67 fetchInitialData: (auth, path) => Post.fetchInitialData(auth, path),
72 fetchInitialData: (auth, path) => Post.fetchInitialData(auth, path),
75 path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
77 fetchInitialData: (auth, path) => Community.fetchInitialData(auth, path),
80 path: `/community/:id`,
82 fetchInitialData: (auth, path) => Community.fetchInitialData(auth, path),
87 fetchInitialData: (auth, path) => Community.fetchInitialData(auth, path),
90 path: `/u/:username/view/:view/sort/:sort/page/:page`,
92 fetchInitialData: (auth, path) => User.fetchInitialData(auth, path),
97 fetchInitialData: (auth, path) => User.fetchInitialData(auth, path),
100 path: `/u/:username`,
102 fetchInitialData: (auth, path) => User.fetchInitialData(auth, path),
107 fetchInitialData: (auth, path) => Inbox.fetchInitialData(auth, path),
110 path: `/modlog/community/:community_id`,
113 { path: `/modlog`, component: Modlog },
114 { path: `/setup`, component: Setup },
115 { path: `/admin`, component: AdminSettings },
117 path: `/search/q/:q/type/:type/sort/:sort/page/:page`,
120 { path: `/search`, component: Search },
121 { path: `/sponsors`, component: Sponsors },
123 path: `/password_change/:token`,
124 component: PasswordChange,
126 { path: `/instances`, component: Instances },