diff --git a/src/components/timer.vue b/src/components/timer.vue index d18c948..e9413e2 100644 --- a/src/components/timer.vue +++ b/src/components/timer.vue @@ -147,13 +147,19 @@ } + }, + confirmClose(event){ + if(this.totalSeconds > 0){ + event.returnValue = "Clear or save your time" + return false + } } }, mounted() { axios.get(import.meta.env.VITE_PRACTICE_TRACKER_API_URL+'categories').then((response)=>{ this.categories = response.data }) - + window.onbeforeunload = this.confirmClose } }