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 { Person } from "./components/person";
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 { Instances } from "./components/instances";
18 import { InitialFetchRequest } from "./interfaces";
20 interface IRoutePropsWithFetch extends IRouteProps {
21 fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
24 export const routes: IRoutePropsWithFetch[] = [
29 fetchInitialData: req => Main.fetchInitialData(req),
32 path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
34 fetchInitialData: req => Main.fetchInitialData(req),
42 component: CreatePost,
43 fetchInitialData: req => CreatePost.fetchInitialData(req),
46 path: `/create_community`,
47 component: CreateCommunity,
50 path: `/create_private_message/recipient/:recipient_id`,
51 component: CreatePrivateMessage,
52 fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
55 path: `/communities/page/:page`,
56 component: Communities,
57 fetchInitialData: req => Communities.fetchInitialData(req),
61 component: Communities,
62 fetchInitialData: req => Communities.fetchInitialData(req),
65 path: `/post/:id/comment/:comment_id`,
67 fetchInitialData: req => Post.fetchInitialData(req),
72 fetchInitialData: req => Post.fetchInitialData(req),
75 path: `/community/:id/data_type/:data_type/sort/:sort/page/:page`,
77 fetchInitialData: req => Community.fetchInitialData(req),
80 path: `/community/:id`,
82 fetchInitialData: req => Community.fetchInitialData(req),
85 path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
87 fetchInitialData: req => Community.fetchInitialData(req),
92 fetchInitialData: req => Community.fetchInitialData(req),
95 path: `/u/:username/view/:view/sort/:sort/page/:page`,
97 fetchInitialData: req => Person.fetchInitialData(req),
100 path: `/user/:id/view/:view/sort/:sort/page/:page`,
102 fetchInitialData: req => Person.fetchInitialData(req),
107 fetchInitialData: req => Person.fetchInitialData(req),
110 path: `/u/:username`,
112 fetchInitialData: req => Person.fetchInitialData(req),
117 fetchInitialData: req => Inbox.fetchInitialData(req),
120 path: `/modlog/community/:community_id`,
122 fetchInitialData: req => Modlog.fetchInitialData(req),
127 fetchInitialData: req => Modlog.fetchInitialData(req),
129 { path: `/setup`, component: Setup },
132 component: AdminSettings,
133 fetchInitialData: req => AdminSettings.fetchInitialData(req),
136 path: `/search/q/:q/type/:type/sort/:sort/page/:page`,
138 fetchInitialData: req => Search.fetchInitialData(req),
143 fetchInitialData: req => Search.fetchInitialData(req),
146 path: `/password_change/:token`,
147 component: PasswordChange,
149 { path: `/instances`, component: Instances },