summaryrefslogtreecommitdiffstats
path: root/ui/src/interfaces.ts
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-18 23:54:10 -0500
committerDessalines <tyhou13@gmx.com>2020-01-18 23:54:10 -0500
commita044718066623f19d51196d444bd199c1231cebe (patch)
treecbffb18d826df1330ce2b7f1a814205ba45148d1 /ui/src/interfaces.ts
parent05ee5a8b600fdd7a64ad66bb52978befed3a7614 (diff)
First pass at fixing UI to work with new websocketresponses.
Diffstat (limited to 'ui/src/interfaces.ts')
-rw-r--r--ui/src/interfaces.ts54
1 files changed, 28 insertions, 26 deletions
diff --git a/ui/src/interfaces.ts b/ui/src/interfaces.ts
index 7fc7a252..3af5be02 100644
--- a/ui/src/interfaces.ts
+++ b/ui/src/interfaces.ts
@@ -226,7 +226,6 @@ export interface FollowCommunityForm {
}
export interface GetFollowedCommunitiesResponse {
- op: string;
communities: Array<CommunityUser>;
}
@@ -241,7 +240,6 @@ export interface GetUserDetailsForm {
}
export interface UserDetailsResponse {
- op: string;
user: UserView;
follows: Array<CommunityUser>;
moderates: Array<CommunityUser>;
@@ -259,7 +257,6 @@ export interface GetRepliesForm {
}
export interface GetRepliesResponse {
- op: string;
replies: Array<Comment>;
}
@@ -272,7 +269,6 @@ export interface GetUserMentionsForm {
}
export interface GetUserMentionsResponse {
- op: string;
mentions: Array<Comment>;
}
@@ -283,7 +279,6 @@ export interface EditUserMentionForm {
}
export interface UserMentionResponse {
- op: string;
mention: Comment;
}
@@ -297,7 +292,6 @@ export interface BanFromCommunityForm {
}
export interface BanFromCommunityResponse {
- op: string;
user: UserView;
banned: boolean;
}
@@ -321,7 +315,6 @@ export interface TransferSiteForm {
}
export interface AddModToCommunityResponse {
- op: string;
moderators: Array<CommunityUser>;
}
@@ -333,7 +326,6 @@ export interface GetModlogForm {
}
export interface GetModlogResponse {
- op: string;
removed_posts: Array<ModRemovePost>;
locked_posts: Array<ModLockPost>;
stickied_posts: Array<ModStickyPost>;
@@ -474,7 +466,6 @@ export interface RegisterForm {
}
export interface LoginResponse {
- op: string;
jwt: string;
}
@@ -509,14 +500,12 @@ export interface CommunityForm {
}
export interface GetCommunityResponse {
- op: string;
community: Community;
moderators: Array<CommunityUser>;
admins: Array<UserView>;
}
export interface CommunityResponse {
- op: string;
community: Community;
}
@@ -528,12 +517,10 @@ export interface ListCommunitiesForm {
}
export interface ListCommunitiesResponse {
- op: string;
communities: Array<Community>;
}
export interface ListCategoriesResponse {
- op: string;
categories: Array<Category>;
}
@@ -562,7 +549,6 @@ export interface PostFormParams {
}
export interface GetPostResponse {
- op: string;
post: Post;
comments: Array<Comment>;
community: Community;
@@ -577,7 +563,6 @@ export interface SavePostForm {
}
export interface PostResponse {
- op: string;
post: Post;
}
@@ -601,7 +586,6 @@ export interface SaveCommentForm {
}
export interface CommentResponse {
- op: string;
comment: Comment;
}
@@ -627,7 +611,6 @@ export interface GetPostsForm {
}
export interface GetPostsResponse {
- op: string;
posts: Array<Post>;
}
@@ -638,7 +621,6 @@ export interface CreatePostLikeForm {
}
export interface CreatePostLikeResponse {
- op: string;
post: Post;
}
@@ -652,7 +634,6 @@ export interface SiteForm {
}
export interface GetSiteResponse {
- op: string;
site: Site;
admins: Array<UserView>;
banned: Array<UserView>;
@@ -660,7 +641,6 @@ export interface GetSiteResponse {
}
export interface SiteResponse {
- op: string;
site: Site;
}
@@ -673,7 +653,6 @@ export interface BanUserForm {
}
export interface BanUserResponse {
- op: string;
user: UserView;
banned: boolean;
}
@@ -685,7 +664,6 @@ export interface AddAdminForm {
}
export interface AddAdminResponse {
- op: string;
admins: Array<UserView>;
}
@@ -699,7 +677,6 @@ export interface SearchForm {
}
export interface SearchResponse {
- op: string;
type_: string;
posts?: Array<Post>;
comments?: Array<Comment>;
@@ -715,12 +692,37 @@ export interface PasswordResetForm {
email: string;
}
-export interface PasswordResetResponse {
- op: string;
-}
+// export interface PasswordResetResponse {
+// }
export interface PasswordChangeForm {
token: string;
password: string;
password_verify: string;
}
+
+type ResponseType =
+ | SiteResponse
+ | GetFollowedCommunitiesResponse
+ | ListCommunitiesResponse
+ | GetPostsResponse
+ | CreatePostLikeResponse
+ | GetRepliesResponse
+ | GetUserMentionsResponse
+ | ListCategoriesResponse
+ | CommunityResponse
+ | CommentResponse
+ | UserMentionResponse
+ | LoginResponse
+ | GetModlogResponse
+ | SearchResponse
+ | BanFromCommunityResponse
+ | AddModToCommunityResponse
+ | BanUserResponse
+ | AddAdminResponse;
+
+export interface WebSocketResponse {
+ op: UserOperation;
+ data: ResponseType;
+ error?: string;
+}