Send notification on appointment update

This commit is contained in:
Maks Snegov 2024-08-01 14:03:51 -07:00
parent c31ab1eb64
commit 8697c717b8

View File

@ -501,8 +501,12 @@ async function runner() {
}
if (apptDate != ctx.currentAppt.date || apptConsulate != ctx.currentAppt.consulate) {
console.log(`New appointment date: ${apptDate} at ${apptConsulate},
old: ${ctx.currentAppt.consulate} at ${ctx.currentAppt.date}`);
msg = `New appointment date: ${apptDate} at ${apptConsulate}`
if (ctx.currentAppt.date != null) {
sendNotification(msg);
}
msg += `, was: ${ctx.currentAppt.consulate} at ${ctx.currentAppt.date}`
console.log(msg);
ctx.currentAppt = { consulate: apptConsulate, date: apptDate };
await chrome.storage.local.set({ "ctx_currentAppt": ctx.currentAppt });
}