diff --git a/backend/secfit/workouts/urls.py b/backend/secfit/workouts/urls.py index a58f81843ae0504442f7fbed4991dec9f423c9fd..1ccbcd0874b80409c3e10eac16b421fc567f9edc 100644 --- a/backend/secfit/workouts/urls.py +++ b/backend/secfit/workouts/urls.py @@ -17,6 +17,7 @@ urlpatterns = format_suffix_patterns( name="workout-detail", ), path("api/goal/", views.GoalList.as_view(), name="goal-list"), + path("api/goal/<int:pk>/", views.GoalDetail.as_view(), name="goal-detail"), path("api/exercises/", views.ExerciseList.as_view(), name="exercise-list"), path( "api/exercises/<int:pk>/", diff --git a/frontend/www/scripts/goal.js b/frontend/www/scripts/goal.js index 7b869187aaffee753eb68ace3af0a22b2c875376..3cc22e73a249a53931a11f618de686d458c706ef 100644 --- a/frontend/www/scripts/goal.js +++ b/frontend/www/scripts/goal.js @@ -112,10 +112,10 @@ async function deleteExercise(id) { } } -async function retrieveExercise(id) { - let response = await sendRequest("GET", `${HOST}/api/exercises/${id}/`); +async function retrieveGoal(id) { + let response = await sendRequest("GET", `${HOST}/api/goal/${id}/`); - console.log(response.ok) + console.log(response) if (!response.ok) { let data = await response.json(); @@ -220,7 +220,7 @@ window.addEventListener("DOMContentLoaded", async () => { // view/edit if (urlParams.has('id')) { const exerciseId = urlParams.get('id'); - await retrieveExercise(exerciseId); + await retrieveGoal(exerciseId); editButton.addEventListener("click", handleEditExerciseButtonClick); deleteButton.addEventListener("click", (async (id) => await deleteExercise(id)).bind(undefined, exerciseId));