update chat page

This commit is contained in:
Ren Amamiya
2023-04-26 17:43:29 +07:00
parent 7a2e08f601
commit 38c6b2c76d
2 changed files with 65 additions and 38 deletions

View File

@@ -49,3 +49,12 @@ export const getParentID = (arr: string[], fallback: string) => {
return parentID;
};
// sort messages by timestamp
export const sortMessages = (arr: any) => {
arr.sort((a, b) => {
return b.created_at - a.created_at;
});
return arr;
};