Add linter and minor bug fixes (#107)

This commit is contained in:
Simon Lecoq
2021-02-05 23:45:48 +01:00
committed by GitHub
parent 61e2f6e1a1
commit 882a93dea5
74 changed files with 1544 additions and 712 deletions

View File

@@ -1,5 +1,5 @@
//Setup
export default async function ({login, q, imports, data, account}, {enabled = false, token} = {}) {
export default async function({login, q, imports, data, account}, {enabled = false, token} = {}) {
//Plugin execution
try {
//Check if plugin is enabled and requirements are met
@@ -12,8 +12,7 @@
limit = void(limit)
const range = {"7":"last_7_days", "30":"last_30_days", "180":"last_6_months", "365":"last_year"}[days] ?? "last_7_days"
//Querying api and format result
//https://wakatime.com/developers#stats
//Querying api and format result (https://wakatime.com/developers#stats)
console.debug(`metrics/compute/${login}/plugins > wakatime > querying api`)
const {data:{data:stats}} = await imports.axios.get(`https://wakatime.com/api/v1/users/current/stats/${range}?api_key=${token}`)
const result = {
@@ -42,4 +41,4 @@
}
throw {error:{message, instance:error}}
}
}
}