This commit is contained in:
2020-07-07 22:53:41 +00:00
parent 2e3df8d638
commit 783cc19502

View File

@@ -1,5 +1,38 @@
/* xeslint-disable */
let _timerId = null;
let keepPolling = false;
export default { startPolling() {}, stopPolling() {} };
export default {
async startPolling() {
console.log("notifypoll::starting polling");
keepPolling = true;
try {
while (keepPolling == true) {
let status = await window.$gz.api.get("notify/new-count");
if (status.error) {
throw status.error;
}
console.log("notifypoll::new count ", status);
// window.$gz.store.commit("setNotifyNewCount", status.data);
await window.$gz.util.sleepAsync(10000);
}
} catch (error) {
keepPolling = false;
window.$gz.errorHandler.handleGeneralError(
"Error checking for notifications",
"notifypoll",
null,
null,
error
);
window.$gz.eventBus.$emit(
"notify-error",
"Error checking for notifications, see about->log for details; log out and back in again to reset"
);
}
},
stopPolling() {
keepPolling = false;
console.log("notifypoll::stopping polling");
}
};