This commit is contained in:
@@ -1,5 +1,38 @@
|
|||||||
/* xeslint-disable */
|
/* 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");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user