feat(02-02): wire deleteLog through App.jsx and WorkoutPage to ExerciseCard

- Added deleteLog function in App.jsx: calls DELETE /api/logs and removes entry from local logs state
- Passed onDeleteSet={deleteLog} to WorkoutPage in workout view render
- Updated WorkoutPage function signature to accept onDeleteSet prop
- Passed onDeleteSet through to each ExerciseCard (ExerciseCard already calls it in handleDeleteSet)
- Non-logged sets (404 from backend) silently ignored via catch block
This commit is contained in:
2026-02-21 18:44:58 +01:00
parent f9eb6ccc65
commit 175434f5c8
2 changed files with 25 additions and 1 deletions
+2 -1
View File
@@ -47,7 +47,7 @@ function getMuscleGroups(exercises) {
return Array.from(groups)
}
function WorkoutPage({ day, week, logs, onLogSet, onBack, fetchProgression }) {
function WorkoutPage({ day, week, logs, onLogSet, onDeleteSet, onBack, fetchProgression }) {
const [progressions, setProgressions] = useState({})
const [expandedExercise, setExpandedExercise] = useState(null)
const [warmupDone, setWarmupDone] = useState(false)
@@ -239,6 +239,7 @@ function WorkoutPage({ day, week, logs, onLogSet, onBack, fetchProgression }) {
expandedExercise === exercise.id ? null : exercise.id
)}
onLogSet={onLogSet}
onDeleteSet={onDeleteSet}
/>
))}
</section>