From 89713b22688d01e94831147df1dd7e9d94ba9e15 Mon Sep 17 00:00:00 2001 From: redesyef Date: Wed, 25 Sep 2024 18:06:52 -0500 Subject: [PATCH] fixed error toast --- ui/components/ChatWindow.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index b63fb12..8ac7940 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -195,12 +195,16 @@ const useSocket = ( }, 2000); }; - ws.addEventListener('message', (e) => { - const data = JSON.parse(e.data); - if (data.type === 'error') { - toast.error(data.data); - } - }); + // ws.addEventListener('message', (e) => { + // const data = JSON.parse(e.data); + // console.log(data); + + // if (data.type === 'error') { + // console.log(data.data); + + // toast.error(data.data); + // } + // }); setWs(ws); }; @@ -376,6 +380,8 @@ const ChatWindow = ({ id }: { id?: string }) => { if (data.type === 'error') { toast.error(data.data); + console.log(data.data); + setLoading(false); return; } @@ -537,6 +543,7 @@ const ChatWindow = ({ id }: { id?: string }) => { } // eslint-disable-next-line react-hooks/exhaustive-deps }, [messages]); + console.log(hasError); // if (hasError) { // return (