1 import { IRouteProps } from "inferno-router/dist/Route";
2 import { Communities } from "./components/community/communities";
3 import { Community } from "./components/community/community";
4 import { CreateCommunity } from "./components/community/create-community";
5 import { AdminSettings } from "./components/home/admin-settings";
6 import { Home } from "./components/home/home";
7 import { Instances } from "./components/home/instances";
8 import { Login } from "./components/home/login";
9 import { PasswordChange } from "./components/home/password_change";
10 import { Setup } from "./components/home/setup";
11 import { Modlog } from "./components/modlog";
12 import { Inbox } from "./components/person/inbox";
13 import { Profile } from "./components/person/profile";
14 import { Settings } from "./components/person/settings";
15 import { CreatePost } from "./components/post/create-post";
16 import { Post } from "./components/post/post";
17 import { CreatePrivateMessage } from "./components/private_message/create-private-message";
18 import { Search } from "./components/search";
19 import { InitialFetchRequest } from "./interfaces";
21 interface IRoutePropsWithFetch extends IRouteProps {
22 fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
25 export const routes: IRoutePropsWithFetch[] = [
30 fetchInitialData: req => Home.fetchInitialData(req),
33 path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
35 fetchInitialData: req => Home.fetchInitialData(req),
43 component: CreatePost,
44 fetchInitialData: req => CreatePost.fetchInitialData(req),
47 path: `/create_community`,
48 component: CreateCommunity,
51 path: `/create_private_message/recipient/:recipient_id`,
52 component: CreatePrivateMessage,
53 fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
56 path: `/communities/listing_type/:listing_type/page/:page`,
57 component: Communities,
58 fetchInitialData: req => Communities.fetchInitialData(req),
62 component: Communities,
63 fetchInitialData: req => Communities.fetchInitialData(req),
66 path: `/post/:id/comment/:comment_id`,
68 fetchInitialData: req => Post.fetchInitialData(req),
73 fetchInitialData: req => Post.fetchInitialData(req),
76 path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
78 fetchInitialData: req => Community.fetchInitialData(req),
83 fetchInitialData: req => Community.fetchInitialData(req),
86 path: `/u/:username/view/:view/sort/:sort/page/:page`,
88 fetchInitialData: req => Profile.fetchInitialData(req),
93 fetchInitialData: req => Profile.fetchInitialData(req),
98 fetchInitialData: req => Inbox.fetchInitialData(req),
105 path: `/modlog/community/:community_id`,
107 fetchInitialData: req => Modlog.fetchInitialData(req),
112 fetchInitialData: req => Modlog.fetchInitialData(req),
114 { path: `/setup`, component: Setup },
117 component: AdminSettings,
118 fetchInitialData: req => AdminSettings.fetchInitialData(req),
121 path: `/search/q/:q/type/:type/sort/:sort/listing_type/:listing_type/community_id/:community_id/creator_id/:creator_id/page/:page`,
123 fetchInitialData: req => Search.fetchInitialData(req),
128 fetchInitialData: req => Search.fetchInitialData(req),
131 path: `/password_change/:token`,
132 component: PasswordChange,
134 { path: `/instances`, component: Instances },