added useDecryptMessage hook and updated chat messages

This commit is contained in:
Ren Amamiya
2023-04-16 12:45:17 +07:00
parent b778cf6198
commit a7e95fd18a
11 changed files with 108 additions and 61 deletions

8
src/stores/chat.tsx Normal file
View File

@@ -0,0 +1,8 @@
import { atom } from 'jotai';
import { atomWithReset } from 'jotai/utils';
export const chatMessagesAtom = atomWithReset([]);
export const sortedChatMessagesAtom = atom((get) => {
const messages = get(chatMessagesAtom);
return messages.sort((x: { created_at: number }, y: { created_at: number }) => x.created_at - y.created_at);
});