add task function

This commit is contained in:
kkzzhizhou 2021-11-22 23:05:12 +08:00
parent 67af22829f
commit 070b437bab
6 changed files with 47 additions and 37 deletions

View file

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