Only clear array of workout data once successfully saved
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user