From 0f3087e20facf19d0c7eea22fd8e6fa822abdf26 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Tue, 3 Sep 2024 15:20:33 +0300 Subject: [PATCH] timer id --- front/src/stores/timer.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/front/src/stores/timer.ts b/front/src/stores/timer.ts index 454e3e8..5ed2e5e 100644 --- a/front/src/stores/timer.ts +++ b/front/src/stores/timer.ts @@ -19,7 +19,7 @@ export const useTimer = defineStore('timer', { startTimer() { this.is_enabled = true this.resetTimer() - this.countdownTimer() + this.timer_el = this.countdownTimer() }, stopTimer() { this.is_enabled = false @@ -36,7 +36,7 @@ export const useTimer = defineStore('timer', { this.seconds_left = time }, countdownTimer() { - this.timer_el = setInterval(() => { + const id = setInterval(() => { if (this.is_enabled && this.seconds_left > 0) { this.seconds_left -= 1 // this.countdownTimer() @@ -45,6 +45,7 @@ export const useTimer = defineStore('timer', { this.stopTimer() } }, 1000) + return id }, } })