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 } }