feature: add/edit/delete tasks

This commit is contained in:
kkzzhizhou 2021-11-28 22:47:54 +08:00
parent 876fe85f08
commit ac57825452
7 changed files with 75 additions and 48 deletions

View file

@ -83,4 +83,19 @@ export async function deleteTask(username: string, credentials: string, id: stri
}
})
return(response)
}
export async function updateTask(username: string, credentials: string, id: string, type: string, title: string, notes: string) {
const url = "https://habitica.com/api/v4/tasks/".concat(id)
const response = fetch(url, {
method: 'PUT',
headers: {
"Content-Type": "application/json",
"x-client": "278e719e-5f9c-43b1-9dba-8b73343dc062-HabiticaSync",
"x-api-user": username,
"x-api-key": credentials,
},
body: JSON.stringify({id: id,type: type, text: title,notes: notes})
})
return(response)
}