Chore: Migrate REST API - getThreadsList to Typescript (#3895)
* chore: add rest api return * chore: removing sort param
This commit is contained in:
parent
a754983ac8
commit
11a809a065
|
@ -38,7 +38,7 @@ export type ChatEndpoints = {
|
||||||
'chat.getThreadsList': {
|
'chat.getThreadsList': {
|
||||||
GET: (params: {
|
GET: (params: {
|
||||||
rid: IServerRoom['_id'];
|
rid: IServerRoom['_id'];
|
||||||
type: 'unread' | 'following' | 'all';
|
type?: 'unread' | 'following' | 'all';
|
||||||
text?: string;
|
text?: string;
|
||||||
offset: number;
|
offset: number;
|
||||||
count: number;
|
count: number;
|
||||||
|
|
|
@ -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 }) => {
|
export const getThreadsList = ({ rid, count, offset, text }: { rid: string; count: number; offset: number; text?: string }) => {
|
||||||
const params: any = {
|
const params = {
|
||||||
rid,
|
rid,
|
||||||
count,
|
count,
|
||||||
offset,
|
offset
|
||||||
sort: { ts: -1 }
|
} as { rid: string; count: number; offset: number; text?: string };
|
||||||
};
|
|
||||||
if (text) {
|
if (text) {
|
||||||
params.text = text;
|
params.text = text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ class ThreadMessagesView extends React.Component<IThreadMessagesViewProps, IThre
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result: any = await RocketChat.getThreadsList({
|
const result = await RocketChat.getThreadsList({
|
||||||
rid: this.rid,
|
rid: this.rid,
|
||||||
count: API_FETCH_COUNT,
|
count: API_FETCH_COUNT,
|
||||||
offset: messages.length,
|
offset: messages.length,
|
||||||
|
|
Loading…
Reference in New Issue