fix: wakatime stats fetcher (#871)

fixes #865
This commit is contained in:
Anurag Hazra
2021-02-10 23:40:57 +05:30
committed by GitHub
parent 799a8c1e22
commit 93ae8d995b
5 changed files with 32 additions and 32 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
const axios = require("axios");
const fetchLast7Days = async ({ username, api_domain }) => {
const fetchWakatimeStats = async ({ username, api_domain }) => {
try {
const { data } = await axios.get(
`https://${
api_domain ? api_domain.replace(/[^a-z-.0-9]/gi, "") : "wakatime.com"
}/api/v1/users/${username}/stats/last_7_days?is_including_today=true`,
}/api/v1/users/${username}/stats?is_including_today=true`,
);
return data.data;
@@ -20,5 +20,5 @@ const fetchLast7Days = async ({ username, api_domain }) => {
};
module.exports = {
fetchLast7Days,
fetchWakatimeStats,
};