Refactor get/add workouts for user endpoint, and update message on completion of workout
This commit is contained in:
@@ -215,17 +215,17 @@
|
||||
// Disconnect from heart rate sensor
|
||||
disconnectHeartRateMonitor();
|
||||
|
||||
fetch("{{ url_for('workouts', user_id=user.id) }}", {
|
||||
fetch("{{ url_for('create_workout', user_id=user.id) }}", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ cadence_readings: workoutData, heart_rate_readings: heartRateData }),
|
||||
}).then(res => res.json())
|
||||
.then(res => {
|
||||
}).then(res => res.text())
|
||||
.then(txt => {
|
||||
workoutData = [];
|
||||
swal("Submitted", JSON.stringify(res), "success");
|
||||
swal("Submitted", txt, "success");
|
||||
})
|
||||
.catch(err => swal("Failed to submit workout", err.message, "error"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user