new feature:delete task

This commit is contained in:
kkzzhizhou 2021-11-23 23:00:47 +08:00
parent bfb4ae627f
commit 73f4cbd16b
13 changed files with 118 additions and 67 deletions

View file

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