From 998c64108a464819481e30429b54cd2cce6191a2 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Fri, 10 Mar 2023 22:57:21 +1100 Subject: [PATCH] Only clear array of workout data once successfully saved --- templates/new_workout.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/new_workout.html b/templates/new_workout.html index 0de53ce..06f5539 100644 --- a/templates/new_workout.html +++ b/templates/new_workout.html @@ -118,11 +118,12 @@ }, body: JSON.stringify({ workout: workout }), }).then(res => res.json()) - .then(res => swal("Submitted", JSON.stringify(res), "success").then(isConfirm => window.location.href = '/')) + .then(res => { + workout = []; + swal("Submitted", JSON.stringify(res), "success").then(isConfirm => window.location.href = '/'); + }) .catch(err => swal("Failed to submit workout", err.message, "error")); - workout = []; - } // Toggle workout