From c80b043c0389612e6c423c8d9a9a9f8616104d9f Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Thu, 8 Aug 2024 22:14:56 +0200 Subject: [PATCH] display local storage saved seconds on timer mount --- src/components/timer.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/timer.vue b/src/components/timer.vue index e9413e2..6cd5000 100644 --- a/src/components/timer.vue +++ b/src/components/timer.vue @@ -69,6 +69,7 @@ this.savedPreviousSeconds = 0; this.comments = null; this.secondsToSubtract = 0; + window.localStorage.setItem('lastTotalSeconds', this.totalSeconds); }); }, @@ -113,6 +114,7 @@ this.savedPreviousSeconds = 0; this.totalSeconds = 0; this.secondsToSubtract = 0; + window.localStorage.setItem('lastTotalSeconds', this.totalSeconds); }, setSecondsManually(){ this.totalSeconds = this.manualHours*60*60 + this.manualMinutes*60 + this.manualSeconds; @@ -159,6 +161,8 @@ axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'categories').then((response)=>{ this.categories = response.data }) + this.totalSeconds = parseInt(window.localStorage.getItem('lastTotalSeconds')) + this.savedPreviousSeconds = this.totalSeconds window.onbeforeunload = this.confirmClose } }