From e5a37756c4dc3b27959bfb1102ac8db9c549409c Mon Sep 17 00:00:00 2001 From: David Gay Date: Sat, 5 Jun 2021 20:46:39 -0400 Subject: Timer: Switch to 1 minute retries after 5 errors, instead of showing an alert and stopping --- app/javascript/controllers/timer_controller.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/javascript/controllers/timer_controller.js') diff --git a/app/javascript/controllers/timer_controller.js b/app/javascript/controllers/timer_controller.js index 30e64cc..dcf046a 100644 --- a/app/javascript/controllers/timer_controller.js +++ b/app/javascript/controllers/timer_controller.js @@ -40,14 +40,15 @@ export default class extends Controller { Rails.ajax({ type: "POST", url: controller.postUrlValue, + success: () => { + this.postFailures = 0; + }, error: () => { this.postFailures++; if (this.postFailures < 5) { setTimeout(controller.finishActivity, 1000); } else { - alert("There was an error completing your activity. If your internet connection is otherwise working," + - " please report this issue, mentioning what you were" + - " doing at the time. Check if refreshing the page resolves this issue, and mention that as well."); + setTimeout(controller.finishActivity, 60000); } }, }); -- cgit v1.2.3