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 { Setup } from "./components/home/setup";
10 import { Signup } from "./components/home/signup";
11 import { Modlog } from "./components/modlog";
12 import { Inbox } from "./components/person/inbox";
13 import { PasswordChange } from "./components/person/password-change";
14 import { Profile } from "./components/person/profile";
15 import { RegistrationApplications } from "./components/person/registration-applications";
16 import { Reports } from "./components/person/reports";
17 import { Settings } from "./components/person/settings";
18 import { VerifyEmail } from "./components/person/verify-email";
19 import { CreatePost } from "./components/post/create-post";
20 import { Post } from "./components/post/post";
21 import { CreatePrivateMessage } from "./components/private_message/create-private-message";
22 import { Search } from "./components/search";
23 import { InitialFetchRequest } from "./interfaces";
25 interface IRoutePropsWithFetch extends IRouteProps {
26 fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
29 export const routes: IRoutePropsWithFetch[] = [
34 fetchInitialData: req => Home.fetchInitialData(req),
37 path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
39 fetchInitialData: req => Home.fetchInitialData(req),
51 component: CreatePost,
52 fetchInitialData: req => CreatePost.fetchInitialData(req),
55 path: `/create_community`,
56 component: CreateCommunity,
59 path: `/create_private_message/recipient/:recipient_id`,
60 component: CreatePrivateMessage,
61 fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
64 path: `/communities/listing_type/:listing_type/page/:page`,
65 component: Communities,
66 fetchInitialData: req => Communities.fetchInitialData(req),
70 component: Communities,
71 fetchInitialData: req => Communities.fetchInitialData(req),
74 path: `/post/:id/comment/:comment_id`,
76 fetchInitialData: req => Post.fetchInitialData(req),
81 fetchInitialData: req => Post.fetchInitialData(req),
84 path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
86 fetchInitialData: req => Community.fetchInitialData(req),
91 fetchInitialData: req => Community.fetchInitialData(req),
94 path: `/u/:username/view/:view/sort/:sort/page/:page`,
96 fetchInitialData: req => Profile.fetchInitialData(req),
101 fetchInitialData: req => Profile.fetchInitialData(req),
106 fetchInitialData: req => Inbox.fetchInitialData(req),
113 path: `/modlog/community/:community_id`,
115 fetchInitialData: req => Modlog.fetchInitialData(req),
120 fetchInitialData: req => Modlog.fetchInitialData(req),
122 { path: `/setup`, component: Setup },
125 component: AdminSettings,
126 fetchInitialData: req => AdminSettings.fetchInitialData(req),
131 fetchInitialData: req => Reports.fetchInitialData(req),
134 path: `/registration_applications`,
135 component: RegistrationApplications,
136 fetchInitialData: req => RegistrationApplications.fetchInitialData(req),
139 path: `/search/q/:q/type/:type/sort/:sort/listing_type/:listing_type/community_id/:community_id/creator_id/:creator_id/page/:page`,
141 fetchInitialData: req => Search.fetchInitialData(req),
146 fetchInitialData: req => Search.fetchInitialData(req),
149 path: `/password_change/:token`,
150 component: PasswordChange,
153 path: `/verify_email/:token`,
154 component: VerifyEmail,
156 { path: `/instances`, component: Instances },