narrow-optician-44716
05/21/2021, 4:09 PM// ...
watch: {
sessionExpiration: {
handler: 'startSessionTimer',
immediate: true
},
// ...
},
methods: {
// ...
startSessionTimer (expiration) {
this.clearTimer();
if (!expiration) return;
const timeout = expiration.getTime() - Date.now();
console.log({ expiration, now: new Date(), timeout });
this.timeoutId = setTimeout(() => {
console.log({ timeoutExecuted: new Date() });
// this.alertAndSignOut();
}, timeout);
},
// ...
Things work OK when I run the app, but during e2e tests, the setTimeout executes immediately, even with very lengthy expiration dates.