diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/controllers/timer_controller.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/controllers/timer_controller.js b/app/javascript/controllers/timer_controller.js index 5190a79..901ec0a 100644 --- a/app/javascript/controllers/timer_controller.js +++ b/app/javascript/controllers/timer_controller.js @@ -32,10 +32,11 @@ export default class extends Controller { return; } + if (controller.counter > 0) controller.counter--; + if (controller.counter > 0) { controller.timerTarget.textContent = controller.counter.toString(); - controller.counter--; - } else if (this.counter <= 0) { + } else { Rails.ajax({ type: "POST", url: controller.postUrlValue, |