Checkboxes sync enabled
This commit is contained in:
parent
51e5f13203
commit
a60eade0ae
3 changed files with 56 additions and 44 deletions
|
|
@ -1,20 +1,5 @@
|
|||
// import fetch from "node-fetch";
|
||||
|
||||
|
||||
export async function getTasks(username: string, credentials: string){
|
||||
const url = "https://habitica.com/api/v3/tasks/user?type=todos"
|
||||
const response = fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-client": username.concat("-testAPI"),
|
||||
"x-api-user": username,
|
||||
"x-api-key": credentials,
|
||||
},
|
||||
})
|
||||
return (response)
|
||||
}
|
||||
|
||||
export async function getStats(username: string, credentials: string){
|
||||
const url = "https://habitica.com/export/userdata.json"
|
||||
const response = fetch(url, {
|
||||
|
|
@ -26,6 +11,19 @@ export async function getStats(username: string, credentials: string){
|
|||
"x-api-key": credentials,
|
||||
},
|
||||
})
|
||||
console.log("stats") //can't print stats from here since the response is still an unresolved promise
|
||||
return (response)
|
||||
}
|
||||
|
||||
export async function scoreTask(username: string, credentials: string, taskID: string, direction: string) {
|
||||
const url = "https://habitica.com/api/v3/tasks/".concat(taskID).concat("/score/").concat(direction)
|
||||
const response = fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-client": username.concat("-testAPI"),
|
||||
"x-api-user": username,
|
||||
"x-api-key": credentials,
|
||||
}
|
||||
})
|
||||
return(response)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue