2021-02-22 02:39:04 +00:00
|
|
|
import { IRouteProps } from "inferno-router/dist/Route";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Communities } from "./components/community/communities";
|
|
|
|
import { Community } from "./components/community/community";
|
|
|
|
import { CreateCommunity } from "./components/community/create-community";
|
|
|
|
import { AdminSettings } from "./components/home/admin-settings";
|
|
|
|
import { Home } from "./components/home/home";
|
|
|
|
import { Instances } from "./components/home/instances";
|
2022-05-26 20:48:58 +00:00
|
|
|
import { Legal } from "./components/home/legal";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Login } from "./components/home/login";
|
|
|
|
import { Setup } from "./components/home/setup";
|
2021-09-19 20:31:17 +00:00
|
|
|
import { Signup } from "./components/home/signup";
|
2021-02-22 02:39:04 +00:00
|
|
|
import { Modlog } from "./components/modlog";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Inbox } from "./components/person/inbox";
|
2021-12-30 15:26:45 +00:00
|
|
|
import { PasswordChange } from "./components/person/password-change";
|
2021-08-20 02:56:18 +00:00
|
|
|
import { Profile } from "./components/person/profile";
|
2021-12-30 15:26:45 +00:00
|
|
|
import { RegistrationApplications } from "./components/person/registration-applications";
|
2021-09-28 10:38:59 +00:00
|
|
|
import { Reports } from "./components/person/reports";
|
2021-08-20 02:56:18 +00:00
|
|
|
import { Settings } from "./components/person/settings";
|
2021-12-30 15:26:45 +00:00
|
|
|
import { VerifyEmail } from "./components/person/verify-email";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { CreatePost } from "./components/post/create-post";
|
|
|
|
import { Post } from "./components/post/post";
|
|
|
|
import { CreatePrivateMessage } from "./components/private_message/create-private-message";
|
2021-02-22 02:39:04 +00:00
|
|
|
import { Search } from "./components/search";
|
|
|
|
import { InitialFetchRequest } from "./interfaces";
|
2023-06-14 12:20:40 +00:00
|
|
|
import { RequestState } from "./services/HttpService";
|
2020-09-06 16:15:25 +00:00
|
|
|
|
2020-09-07 03:41:46 +00:00
|
|
|
interface IRoutePropsWithFetch extends IRouteProps {
|
2023-01-04 16:56:24 +00:00
|
|
|
// TODO Make sure this one is good.
|
2023-06-14 12:20:40 +00:00
|
|
|
fetchInitialData?(req: InitialFetchRequest): Promise<RequestState<any>>[];
|
2020-09-07 03:41:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const routes: IRoutePropsWithFetch[] = [
|
2020-09-08 04:09:11 +00:00
|
|
|
{
|
|
|
|
path: `/`,
|
2021-07-17 20:42:55 +00:00
|
|
|
component: Home,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Home.fetchInitialData,
|
|
|
|
exact: true,
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
2020-09-09 03:13:26 +00:00
|
|
|
{
|
|
|
|
path: `/login`,
|
|
|
|
component: Login,
|
|
|
|
},
|
2021-09-19 20:31:17 +00:00
|
|
|
{
|
|
|
|
path: `/signup`,
|
|
|
|
component: Signup,
|
|
|
|
},
|
2020-09-07 22:24:48 +00:00
|
|
|
{
|
|
|
|
path: `/create_post`,
|
|
|
|
component: CreatePost,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: CreatePost.fetchInitialData,
|
2020-09-07 22:24:48 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/create_community`,
|
|
|
|
component: CreateCommunity,
|
|
|
|
},
|
2020-09-06 16:15:25 +00:00
|
|
|
{
|
2023-04-15 14:47:10 +00:00
|
|
|
path: `/create_private_message/:recipient_id`,
|
2020-09-06 16:15:25 +00:00
|
|
|
component: CreatePrivateMessage,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: CreatePrivateMessage.fetchInitialData,
|
2020-09-07 03:41:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/communities`,
|
|
|
|
component: Communities,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Communities.fetchInitialData,
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{
|
2022-07-30 13:28:08 +00:00
|
|
|
path: `/post/:post_id`,
|
2020-09-06 16:15:25 +00:00
|
|
|
component: Post,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Post.fetchInitialData,
|
2020-09-09 00:48:17 +00:00
|
|
|
},
|
|
|
|
{
|
2022-07-30 13:28:08 +00:00
|
|
|
path: `/comment/:comment_id`,
|
2020-09-09 00:48:17 +00:00
|
|
|
component: Post,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Post.fetchInitialData,
|
2021-02-08 20:14:34 +00:00
|
|
|
},
|
2020-09-08 15:17:49 +00:00
|
|
|
{
|
|
|
|
path: `/c/:name`,
|
|
|
|
component: Community,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Community.fetchInitialData,
|
2020-09-09 00:48:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/u/:username`,
|
2021-08-20 02:56:18 +00:00
|
|
|
component: Profile,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Profile.fetchInitialData,
|
2020-09-09 00:48:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/inbox`,
|
|
|
|
component: Inbox,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Inbox.fetchInitialData,
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
2021-08-20 02:56:18 +00:00
|
|
|
{
|
|
|
|
path: `/settings`,
|
|
|
|
component: Settings,
|
|
|
|
},
|
2020-09-06 16:15:25 +00:00
|
|
|
{
|
2023-05-04 02:06:59 +00:00
|
|
|
path: `/modlog/:communityId`,
|
2020-09-06 16:15:25 +00:00
|
|
|
component: Modlog,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Modlog.fetchInitialData,
|
2020-09-09 02:40:36 +00:00
|
|
|
},
|
|
|
|
{
|
2023-05-04 02:06:59 +00:00
|
|
|
path: `/modlog`,
|
2020-09-09 02:40:36 +00:00
|
|
|
component: Modlog,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Modlog.fetchInitialData,
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{ path: `/setup`, component: Setup },
|
2020-09-09 02:40:36 +00:00
|
|
|
{
|
|
|
|
path: `/admin`,
|
|
|
|
component: AdminSettings,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: AdminSettings.fetchInitialData,
|
2020-09-09 02:40:36 +00:00
|
|
|
},
|
2021-09-28 10:38:59 +00:00
|
|
|
{
|
|
|
|
path: `/reports`,
|
|
|
|
component: Reports,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Reports.fetchInitialData,
|
2021-09-28 10:38:59 +00:00
|
|
|
},
|
2021-12-30 15:26:45 +00:00
|
|
|
{
|
|
|
|
path: `/registration_applications`,
|
|
|
|
component: RegistrationApplications,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: RegistrationApplications.fetchInitialData,
|
2020-09-09 02:40:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/search`,
|
|
|
|
component: Search,
|
2023-04-15 14:47:10 +00:00
|
|
|
fetchInitialData: Search.fetchInitialData,
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/password_change/:token`,
|
|
|
|
component: PasswordChange,
|
|
|
|
},
|
2021-12-30 15:26:45 +00:00
|
|
|
{
|
|
|
|
path: `/verify_email/:token`,
|
|
|
|
component: VerifyEmail,
|
|
|
|
},
|
2023-05-11 18:32:32 +00:00
|
|
|
{
|
|
|
|
path: `/instances`,
|
|
|
|
component: Instances,
|
|
|
|
fetchInitialData: Instances.fetchInitialData,
|
|
|
|
},
|
2022-05-26 20:48:58 +00:00
|
|
|
{ path: `/legal`, component: Legal },
|
2020-09-06 16:15:25 +00:00
|
|
|
];
|