Skip to content

Commit

Permalink
exercises ui - send null if empty link
Browse files Browse the repository at this point in the history
  • Loading branch information
guidomarchini committed May 16, 2020
1 parent ba33e1b commit 4529958
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/resources/templates/exercises.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
}
function createExercise() {
let link = null
if ($('#exercise-create-link').val() != "") {
link = $('#exercise-create-link').val()
}
const body = {
"name": $('#exercise-create-name').val(),
"description": $('#exercise-create-description').val(),
"link": $('#exercise-create-link').val()
"link": link
}
fetch('api/exercises', {
Expand All @@ -39,11 +44,16 @@
}
function editExercise(id) {
let link = null
if ($('#exercise-create-link').val() != "") {
link = $('#exercise-create-link').val()
}
const body = {
"id": id,
"name": $('#exercise-edit-name').val(),
"description": $('#exercise-edit-description').val(),
"link": $('#exercise-edit-link').val()
"link": link
}
fetch('api/exercises', {
Expand Down

0 comments on commit 4529958

Please sign in to comment.