From aae7b6da6466df5c0ebc23638633c11cbcb63a96 Mon Sep 17 00:00:00 2001 From: ilya-bkv Date: Mon, 5 Dec 2022 10:39:41 +0300 Subject: [PATCH] Add render messages --- src/components/Inbox/Message.tsx | 1 - src/components/Views/Inbox.tsx | 5 +++-- src/utils/apiClient.ts | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/Inbox/Message.tsx b/src/components/Inbox/Message.tsx index d31c12cf..0dc5827b 100644 --- a/src/components/Inbox/Message.tsx +++ b/src/components/Inbox/Message.tsx @@ -24,7 +24,6 @@ const Message = (props: Props) => { }) }) - console.log('!!! props.ownId:', props.ownId) // возвращать ID автора const isOwn = props.ownId === Number(props.content.author) diff --git a/src/components/Views/Inbox.tsx b/src/components/Views/Inbox.tsx index ec87fe6e..6e6c9b8e 100644 --- a/src/components/Views/Inbox.tsx +++ b/src/components/Views/Inbox.tsx @@ -53,13 +53,15 @@ export const InboxView = () => { const handleOpenChat = async (chat) => { setCurrentDialog(chat) try { - await loadMessages({ chat: chat.id }) + const response = await loadMessages({ chat: chat.id }) + setMessages(response as unknown as MessageType[]) } catch (error) { console.error('[loadMessages]', error) } finally { chatWindow.scrollTop = chatWindow.scrollHeight } } + onMount(async () => { try { const response = await loadRecipients({ days: 365 }) @@ -108,7 +110,6 @@ export const InboxView = () => { } createEffect(() => { - console.log('!!! messages():', messages()) console.log('!!! currentDialog():', currentDialog()) }) diff --git a/src/utils/apiClient.ts b/src/utils/apiClient.ts index f8934d30..33e66cb0 100644 --- a/src/utils/apiClient.ts +++ b/src/utils/apiClient.ts @@ -283,7 +283,6 @@ export const apiClient = { createMessage: async (options: MutationCreateMessageArgs) => { const resp = await privateGraphQLClient.mutation(createMessage, options).toPromise() - console.log('!!! resp:', resp) return resp.data.createMessage },