display local storage saved seconds on timer mount

practiced-songs
Matthew Huntington 1 year ago
parent ae9367384b
commit c80b043c03

@ -69,6 +69,7 @@
this.savedPreviousSeconds = 0; this.savedPreviousSeconds = 0;
this.comments = null; this.comments = null;
this.secondsToSubtract = 0; this.secondsToSubtract = 0;
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
}); });
}, },
@ -113,6 +114,7 @@
this.savedPreviousSeconds = 0; this.savedPreviousSeconds = 0;
this.totalSeconds = 0; this.totalSeconds = 0;
this.secondsToSubtract = 0; this.secondsToSubtract = 0;
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
}, },
setSecondsManually(){ setSecondsManually(){
this.totalSeconds = this.manualHours*60*60 + this.manualMinutes*60 + this.manualSeconds; 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)=>{ axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'categories').then((response)=>{
this.categories = response.data this.categories = response.data
}) })
this.totalSeconds = parseInt(window.localStorage.getItem('lastTotalSeconds'))
this.savedPreviousSeconds = this.totalSeconds
window.onbeforeunload = this.confirmClose window.onbeforeunload = this.confirmClose
} }
} }

Loading…
Cancel
Save