소스 검색

Present error if new exercise has no text.

Lee Morgan 1 년 전
부모
커밋
85a8aed940
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      views/js/pages/editWorkout.js

+ 5 - 0
views/js/pages/editWorkout.js

@@ -57,6 +57,11 @@ export default {
         const template = document.getElementById("editWorkoutExercise").content.children[0];
         const input = document.getElementById("newExerciseInput");
 
+        if(input.value === ""){
+            notify("error", "Exercise must have a name");
+            return;
+        }
+
         const exercise = template.cloneNode(true);
         exercise.querySelector("p").textContent = input.value;
         exercise.querySelector(".editWorkoutDelete").addEventListener("click", ()=>{