refactor: Use Tauri WebSocket

This commit is contained in:
MystiPanda
2024-01-14 17:30:18 +08:00
parent 1c9bc00acc
commit 71103bb7b9
9 changed files with 142 additions and 47 deletions

View File

@@ -16,7 +16,7 @@ export const useLogSetup = () => {
const setLogData = useSetRecoilState(atomLogData);
const { connect, disconnect } = useWebsocket((event) => {
const data = JSON.parse(event.data) as ILogItem;
const data = JSON.parse(event) as ILogItem;
const time = dayjs().format("MM-DD HH:mm:ss");
setLogData((l) => {
if (l.length >= MAX_LOG_NUM) l.shift();