Prechádzať zdrojové kódy

update tasks after update current task

Petr 4 rokov pred
rodič
commit
77c1c3aafe
1 zmenil súbory, kde vykonal 10 pridanie a 1 odobranie
  1. 10 1
      public/js/taskForm.js

+ 10 - 1
public/js/taskForm.js

@@ -99,7 +99,16 @@ async function updateTask() {
         }
     )
     if (response.status === 201) {
-        await loadNewTaskList();
+        let result = await response.json()
+        await loadNewTaskList()
+        document.querySelector('#taskFormContainer #task_id').value = result.body.id
+        document.querySelector('#taskFormContainer #name').value = result.body.name
+        document.querySelector('#taskFormContainer #type_name').value = result.body.type.name
+        document.querySelector('#taskFormContainer #place').value = result.body.place
+        document.querySelector('#taskFormContainer #date').value = result.body.date
+        document.querySelector('#taskFormContainer #time').value = result.body.time
+        document.querySelector('#taskFormContainer #duration').value = result.body.duration
+        document.querySelector('#taskFormContainer #comment').value = result.body.comment
 
 
     } else if (response.status === 422) {