Adding tasks now works v0.0.17
This commit is contained in:
parent
eb919708d2
commit
e12ccd9129
@ -37,7 +37,7 @@ addTaskBtn.addEventListener("click", function() {
|
|||||||
|
|
||||||
const newTaskPromise = newTask(taskName, taskDescription, token);
|
const newTaskPromise = newTask(taskName, taskDescription, token);
|
||||||
newTaskPromise.then((res) => res.json()).then((json => {
|
newTaskPromise.then((res) => res.json()).then((json => {
|
||||||
console.log(json);
|
window.location.reload();
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -160,14 +160,14 @@ const updateTask = (userToken, taskTitle, taskDescription, completedStatus) => {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newTask = (name, description, userToken) => {
|
const newTask = (title, description, userToken) => {
|
||||||
const res = fetch(`${url}/user/update-tasks`, {
|
const res = fetch(`${url}/user/update-tasks`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
headers: {Authorization: `Bearer ${userToken}`, "Content-Type": "application/json"},
|
headers: {Authorization: `Bearer ${userToken}`, "Content-Type": "application/json"},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
name: name,
|
"title": title,
|
||||||
description: description,
|
"description": description,
|
||||||
is_completed: false
|
"is_completed": false
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user