This commit is contained in:
Kseninia Mikhaylova 2024-09-03 15:20:33 +03:00
parent ffb7e702c7
commit 0f3087e20f
1 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ export const useTimer = defineStore('timer', {
startTimer() { startTimer() {
this.is_enabled = true this.is_enabled = true
this.resetTimer() this.resetTimer()
this.countdownTimer() this.timer_el = this.countdownTimer()
}, },
stopTimer() { stopTimer() {
this.is_enabled = false this.is_enabled = false
@ -36,7 +36,7 @@ export const useTimer = defineStore('timer', {
this.seconds_left = time this.seconds_left = time
}, },
countdownTimer() { countdownTimer() {
this.timer_el = setInterval(() => { const id = setInterval(() => {
if (this.is_enabled && this.seconds_left > 0) { if (this.is_enabled && this.seconds_left > 0) {
this.seconds_left -= 1 this.seconds_left -= 1
// this.countdownTimer() // this.countdownTimer()
@ -45,6 +45,7 @@ export const useTimer = defineStore('timer', {
this.stopTimer() this.stopTimer()
} }
}, 1000) }, 1000)
return id
}, },
} }
}) })