confirm close with unsaved seconds

practiced-songs
Matthew Huntington 1 year ago
parent c4365dfe56
commit 2fe364b0ba

@ -147,13 +147,19 @@
} }
},
confirmClose(event){
if(this.totalSeconds > 0){
event.returnValue = "Clear or save your time"
return false
}
} }
}, },
mounted() { mounted() {
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
}) })
window.onbeforeunload = this.confirmClose
} }
} }
</script> </script>

Loading…
Cancel
Save