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 { Signup } from "./components/home/signup";
12 import { Modlog } from "./components/modlog";
13 import { Inbox } from "./components/person/inbox";
14 import { Profile } from "./components/person/profile";
15 import { Reports } from "./components/person/reports";
16 import { Settings } from "./components/person/settings";
17 import { CreatePost } from "./components/post/create-post";
18 import { Post } from "./components/post/post";
19 import { CreatePrivateMessage } from "./components/private_message/create-private-message";
20 import { Search } from "./components/search";
21 import { InitialFetchRequest } from "./interfaces";
23 interface IRoutePropsWithFetch extends IRouteProps {
24 fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
27 export const routes: IRoutePropsWithFetch[] = [
32 fetchInitialData: req => Home.fetchInitialData(req),
35 path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
37 fetchInitialData: req => Home.fetchInitialData(req),
49 component: CreatePost,
50 fetchInitialData: req => CreatePost.fetchInitialData(req),
53 path: `/create_community`,
54 component: CreateCommunity,
57 path: `/create_private_message/recipient/:recipient_id`,
58 component: CreatePrivateMessage,
59 fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
62 path: `/communities/listing_type/:listing_type/page/:page`,
63 component: Communities,
64 fetchInitialData: req => Communities.fetchInitialData(req),
68 component: Communities,
69 fetchInitialData: req => Communities.fetchInitialData(req),
72 path: `/post/:id/comment/:comment_id`,
74 fetchInitialData: req => Post.fetchInitialData(req),
79 fetchInitialData: req => Post.fetchInitialData(req),
82 path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
84 fetchInitialData: req => Community.fetchInitialData(req),
89 fetchInitialData: req => Community.fetchInitialData(req),
92 path: `/u/:username/view/:view/sort/:sort/page/:page`,
94 fetchInitialData: req => Profile.fetchInitialData(req),
99 fetchInitialData: req => Profile.fetchInitialData(req),
104 fetchInitialData: req => Inbox.fetchInitialData(req),
111 path: `/modlog/community/:community_id`,
113 fetchInitialData: req => Modlog.fetchInitialData(req),
118 fetchInitialData: req => Modlog.fetchInitialData(req),
120 { path: `/setup`, component: Setup },
123 component: AdminSettings,
124 fetchInitialData: req => AdminSettings.fetchInitialData(req),
129 fetchInitialData: req => Reports.fetchInitialData(req),
132 path: `/search/q/:q/type/:type/sort/:sort/listing_type/:listing_type/community_id/:community_id/creator_id/:creator_id/page/:page`,
134 fetchInitialData: req => Search.fetchInitialData(req),
139 fetchInitialData: req => Search.fetchInitialData(req),
142 path: `/password_change/:token`,
143 component: PasswordChange,
145 { path: `/instances`, component: Instances },