Removed repeated code and added reusability for scoring tasks
This commit is contained in:
parent
977cacb8f6
commit
a8a4e32f7b
2 changed files with 37 additions and 112 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
export async function getStats(username: string, credentials: string){
|
||||
const url = "https://habitica.com/export/userdata.json"
|
||||
const response = fetch(url, {
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -11,7 +11,7 @@ export async function getStats(username: string, credentials: string){
|
|||
"x-api-key": credentials,
|
||||
},
|
||||
})
|
||||
return (response)
|
||||
return (await response)
|
||||
}
|
||||
|
||||
export async function scoreTask(username: string, credentials: string, taskID: string, direction: string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue