Revert "perf(前端): 邮件: 取消定时收件"

This reverts commit 3e5599b155.
dev/supplier-email-drawer
Lei OT 9 months ago
parent 9e7f8ceb2f
commit d60b1502ee

@ -56,21 +56,38 @@ function AuthApp() {
} else {
Notification.requestPermission()
}
let _fetchEmailWorker;
if (loginUser.userId > 0) {
appendRequestHeader('X-User-Id', loginUser.userId)
loadPageSpy(loginUser.username)
connectWebsocket(loginUser.userId)
fetchInitialData(loginUser)
_fetchEmailWorker = startEmailInterval(loginUser.userId)
}
return () => {
disconnectWebsocket()
fetchEmailWorker.postMessage({ command: 'logout' })
if (_fetchEmailWorker) {
_fetchEmailWorker.terminate();
}
}
}, [])
useGlobalNotify();
const startEmailInterval = (userId) => {
// const fetchEmailWorker = new Worker(fetchEmailWorkerURL, { type: 'module' });
fetchEmailWorker.onerror = function(error) {
console.error('There was an error in the worker', error);
};
fetchEmailWorker.onmessage = function(event) {
// console.log('Received message from worker', event.data, event.message);
};
fetchEmailWorker.postMessage({ command: 'fetchEmail', param: { opi_sn: userId } });
return fetchEmailWorker;
}
const uploadLog = async () => {
await readWebsocketLog()
if (window.$pageSpy) {

Loading…
Cancel
Save