]> Untitled Git - lemmy-ui.git/blob - src/shared/interfaces.ts
Handle error when site not returned
[lemmy-ui.git] / src / shared / interfaces.ts
1 import { CommentView, GetSiteResponse, LemmyHttp } from "lemmy-js-client";
2 import type { ParsedQs } from "qs";
3
4 /**
5  * This contains serialized data, it needs to be deserialized before use.
6  */
7 export interface IsoData {
8   path: string;
9   routeData: any[];
10   site_res: GetSiteResponse;
11 }
12
13 export type IsoDataOptionalSite = Partial<IsoData> &
14   Pick<IsoData, Exclude<keyof IsoData, "site_res">>;
15
16 export interface ILemmyConfig {
17   wsHost?: string;
18 }
19
20 declare global {
21   interface Window {
22     isoData: IsoData;
23     lemmyConfig?: ILemmyConfig;
24   }
25 }
26
27 export interface InitialFetchRequest<T extends ParsedQs = ParsedQs> {
28   auth?: string;
29   client: LemmyHttp;
30   path: string;
31   query: T;
32   site: GetSiteResponse;
33 }
34
35 export interface PostFormParams {
36   name?: string;
37   url?: string;
38   body?: string;
39 }
40
41 export enum CommentViewType {
42   Tree,
43   Flat,
44 }
45
46 export enum DataType {
47   Post,
48   Comment,
49 }
50
51 export enum BanType {
52   Community,
53   Site,
54 }
55
56 export enum PersonDetailsView {
57   Overview = "Overview",
58   Comments = "Comments",
59   Posts = "Posts",
60   Saved = "Saved",
61 }
62
63 export enum PurgeType {
64   Person,
65   Community,
66   Post,
67   Comment,
68 }
69
70 export interface CommentNodeI {
71   comment_view: CommentView;
72   children: Array<CommentNodeI>;
73   depth: number;
74 }