Chore: Migrate REST API - getThreadsList to Typescript (#3895)

* chore: add rest api return

* chore: removing sort param
This commit is contained in:
Alex Junior 2022-03-16 23:24:22 -03:00 committed by GitHub
parent a754983ac8
commit 11a809a065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -38,7 +38,7 @@ export type ChatEndpoints = {
'chat.getThreadsList': {
GET: (params: {
rid: IServerRoom['_id'];
type: 'unread' | 'following' | 'all';
type?: 'unread' | 'following' | 'all';
text?: string;
offset: number;
count: number;

View File

@ -656,12 +656,11 @@ export const toggleFollowMessage = (mid: string, follow: boolean) => {
};
export const getThreadsList = ({ rid, count, offset, text }: { rid: string; count: number; offset: number; text?: string }) => {
const params: any = {
const params = {
rid,
count,
offset,
sort: { ts: -1 }
};
offset
} as { rid: string; count: number; offset: number; text?: string };
if (text) {
params.text = text;
}

View File

@ -335,7 +335,7 @@ class ThreadMessagesView extends React.Component<IThreadMessagesViewProps, IThre
this.setState({ loading: true });
try {
const result: any = await RocketChat.getThreadsList({
const result = await RocketChat.getThreadsList({
rid: this.rid,
count: API_FETCH_COUNT,
offset: messages.length,