fixed error toast
This commit is contained in:
parent
a4bf5b4579
commit
89713b2268
1 changed files with 13 additions and 6 deletions
|
@ -195,12 +195,16 @@ const useSocket = (
|
||||||
}, 2000);
|
}, 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
ws.addEventListener('message', (e) => {
|
// ws.addEventListener('message', (e) => {
|
||||||
const data = JSON.parse(e.data);
|
// const data = JSON.parse(e.data);
|
||||||
if (data.type === 'error') {
|
// console.log(data);
|
||||||
toast.error(data.data);
|
|
||||||
}
|
// if (data.type === 'error') {
|
||||||
});
|
// console.log(data.data);
|
||||||
|
|
||||||
|
// toast.error(data.data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
setWs(ws);
|
setWs(ws);
|
||||||
};
|
};
|
||||||
|
@ -376,6 +380,8 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||||
|
|
||||||
if (data.type === 'error') {
|
if (data.type === 'error') {
|
||||||
toast.error(data.data);
|
toast.error(data.data);
|
||||||
|
console.log(data.data);
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -537,6 +543,7 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [messages]);
|
}, [messages]);
|
||||||
|
console.log(hasError);
|
||||||
|
|
||||||
// if (hasError) {
|
// if (hasError) {
|
||||||
// return (
|
// return (
|
||||||
|
|
Loading…
Add table
Reference in a new issue