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";
|
2020-09-06 16:15:25 +00:00
|
|
|
|
2020-09-07 03:41:46 +00:00
|
|
|
interface IRoutePropsWithFetch extends IRouteProps {
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData?(req: InitialFetchRequest): Promise<any>[];
|
2020-09-07 03:41:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const routes: IRoutePropsWithFetch[] = [
|
2020-09-08 04:09:11 +00:00
|
|
|
{
|
|
|
|
path: `/`,
|
2020-09-08 18:44:55 +00:00
|
|
|
exact: true,
|
2021-07-17 20:42:55 +00:00
|
|
|
component: Home,
|
|
|
|
fetchInitialData: req => Home.fetchInitialData(req),
|
2020-09-08 04:09:11 +00:00
|
|
|
},
|
2020-09-06 16:15:25 +00:00
|
|
|
{
|
|
|
|
path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
|
2021-07-17 20:42:55 +00:00
|
|
|
component: Home,
|
|
|
|
fetchInitialData: req => Home.fetchInitialData(req),
|
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,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => CreatePost.fetchInitialData(req),
|
2020-09-07 22:24:48 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/create_community`,
|
|
|
|
component: CreateCommunity,
|
|
|
|
},
|
2020-09-06 16:15:25 +00:00
|
|
|
{
|
2020-09-08 18:44:55 +00:00
|
|
|
path: `/create_private_message/recipient/:recipient_id`,
|
2020-09-06 16:15:25 +00:00
|
|
|
component: CreatePrivateMessage,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => CreatePrivateMessage.fetchInitialData(req),
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{
|
2021-07-18 16:17:50 +00:00
|
|
|
path: `/communities/listing_type/:listing_type/page/:page`,
|
2020-09-06 16:15:25 +00:00
|
|
|
component: Communities,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Communities.fetchInitialData(req),
|
2020-09-07 03:41:46 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/communities`,
|
|
|
|
component: Communities,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Communities.fetchInitialData(req),
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/post/:id/comment/:comment_id`,
|
|
|
|
component: Post,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Post.fetchInitialData(req),
|
2020-09-09 00:48:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/post/:id`,
|
|
|
|
component: Post,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Post.fetchInitialData(req),
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
2021-02-08 20:14:34 +00:00
|
|
|
{
|
|
|
|
path: `/c/:name/data_type/:data_type/sort/:sort/page/:page`,
|
|
|
|
component: Community,
|
|
|
|
fetchInitialData: req => Community.fetchInitialData(req),
|
|
|
|
},
|
2020-09-08 15:17:49 +00:00
|
|
|
{
|
|
|
|
path: `/c/:name`,
|
|
|
|
component: Community,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Community.fetchInitialData(req),
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/u/:username/view/:view/sort/:sort/page/:page`,
|
2021-08-20 02:56:18 +00:00
|
|
|
component: Profile,
|
|
|
|
fetchInitialData: req => Profile.fetchInitialData(req),
|
2020-09-09 00:48:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/u/:username`,
|
2021-08-20 02:56:18 +00:00
|
|
|
component: Profile,
|
|
|
|
fetchInitialData: req => Profile.fetchInitialData(req),
|
2020-09-09 00:48:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/inbox`,
|
|
|
|
component: Inbox,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Inbox.fetchInitialData(req),
|
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
|
|
|
{
|
|
|
|
path: `/modlog/community/:community_id`,
|
|
|
|
component: Modlog,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Modlog.fetchInitialData(req),
|
2020-09-09 02:40:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/modlog`,
|
|
|
|
component: Modlog,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Modlog.fetchInitialData(req),
|
2020-09-06 16:15:25 +00:00
|
|
|
},
|
|
|
|
{ path: `/setup`, component: Setup },
|
2020-09-09 02:40:36 +00:00
|
|
|
{
|
|
|
|
path: `/admin`,
|
|
|
|
component: AdminSettings,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => AdminSettings.fetchInitialData(req),
|
2020-09-09 02:40:36 +00:00
|
|
|
},
|
2021-09-28 10:38:59 +00:00
|
|
|
{
|
|
|
|
path: `/reports`,
|
|
|
|
component: Reports,
|
|
|
|
fetchInitialData: req => Reports.fetchInitialData(req),
|
|
|
|
},
|
2021-12-30 15:26:45 +00:00
|
|
|
{
|
|
|
|
path: `/registration_applications`,
|
|
|
|
component: RegistrationApplications,
|
|
|
|
fetchInitialData: req => RegistrationApplications.fetchInitialData(req),
|
|
|
|
},
|
2020-09-06 16:15:25 +00:00
|
|
|
{
|
2021-04-23 21:48:31 +00:00
|
|
|
path: `/search/q/:q/type/:type/sort/:sort/listing_type/:listing_type/community_id/:community_id/creator_id/:creator_id/page/:page`,
|
2020-09-06 16:15:25 +00:00
|
|
|
component: Search,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Search.fetchInitialData(req),
|
2020-09-09 02:40:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: `/search`,
|
|
|
|
component: Search,
|
2020-11-12 21:56:46 +00:00
|
|
|
fetchInitialData: req => Search.fetchInitialData(req),
|
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,
|
|
|
|
},
|
2020-09-06 16:15:25 +00:00
|
|
|
{ path: `/instances`, component: Instances },
|
2022-05-26 20:48:58 +00:00
|
|
|
{ path: `/legal`, component: Legal },
|
2020-09-06 16:15:25 +00:00
|
|
|
];
|