-import { Either, Option } from "@sniptt/monads";
-import {
- CommentView,
- GetSiteResponse,
- LemmyHttp,
- PersonMentionView,
-} from "lemmy-js-client";
+import { CommentView, GetSiteResponse } from "lemmy-js-client";
+import type { ParsedQs } from "qs";
+import { RequestState, WrappedLemmyHttp } from "./services/HttpService";
+import { ErrorPageData } from "./utils";
/**
* This contains serialized data, it needs to be deserialized before use.
*/
export interface IsoData {
path: string;
- routeData: any[];
+ routeData: RequestState<any>[];
site_res: GetSiteResponse;
+ errorPageData?: ErrorPageData;
}
+export type IsoDataOptionalSite = Partial<IsoData> &
+ Pick<IsoData, Exclude<keyof IsoData, "site_res">>;
+
export interface ILemmyConfig {
wsHost?: string;
}
}
}
-export interface InitialFetchRequest {
- auth: Option<string>;
- client: LemmyHttp;
+export interface InitialFetchRequest<T extends ParsedQs = ParsedQs> {
+ auth?: string;
+ client: WrappedLemmyHttp;
path: string;
-}
-
-export interface CommentNode {
- comment_view: CommentView | PersonMentionView;
- children?: CommentNode[];
- depth?: number;
+ query: T;
+ site: GetSiteResponse;
}
export interface PostFormParams {
- name: Option<string>;
- url: Option<string>;
- body: Option<string>;
- nameOrId: Option<Either<string, number>>;
-}
-
-export enum CommentSortType {
- Hot,
- Top,
- New,
- Old,
+ name?: string;
+ url?: string;
+ body?: string;
}
export enum CommentViewType {
Tree,
- Chat,
+ Flat,
}
export enum DataType {
}
export enum PersonDetailsView {
- Overview,
- Comments,
- Posts,
- Saved,
+ Overview = "Overview",
+ Comments = "Comments",
+ Posts = "Posts",
+ Saved = "Saved",
+}
+
+export enum PurgeType {
+ Person,
+ Community,
+ Post,
+ Comment,
+}
+
+export enum VoteType {
+ Upvote,
+ Downvote,
+}
+
+export interface CommentNodeI {
+ comment_view: CommentView;
+ children: Array<CommentNodeI>;
+ depth: number;
}