Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tdt4242-ex2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jørgen Hollum
tdt4242-ex2
Commits
a5f12a9c
Commit
a5f12a9c
authored
3 years ago
by
hollum
Browse files
Options
Downloads
Patches
Plain Diff
get goal though uri
parent
a711426a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/secfit/workouts/urls.py
+1
-0
1 addition, 0 deletions
backend/secfit/workouts/urls.py
frontend/www/scripts/goal.js
+4
-4
4 additions, 4 deletions
frontend/www/scripts/goal.js
with
5 additions
and
4 deletions
backend/secfit/workouts/urls.py
+
1
−
0
View file @
a5f12a9c
...
...
@@ -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>/
"
,
...
...
This diff is collapsed.
Click to expand it.
frontend/www/scripts/goal.js
+
4
−
4
View file @
a5f12a9c
...
...
@@ -112,10 +112,10 @@ async function deleteExercise(id) {
}
}
async
function
retrieve
Exercise
(
id
)
{
let
response
=
await
sendRequest
(
"
GET
"
,
`
${
HOST
}
/api/
exercises
/
${
id
}
/`
);
async
function
retrieve
Goal
(
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
retrieve
Exercise
(
exerciseId
);
await
retrieve
Goal
(
exerciseId
);
editButton
.
addEventListener
(
"
click
"
,
handleEditExerciseButtonClick
);
deleteButton
.
addEventListener
(
"
click
"
,
(
async
(
id
)
=>
await
deleteExercise
(
id
)).
bind
(
undefined
,
exerciseId
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment