diff --git a/src/twitch.ts b/src/twitch.ts index 9c2313a..d6a4906 100644 --- a/src/twitch.ts +++ b/src/twitch.ts @@ -19,7 +19,6 @@ async function refreshApiToken(tokens: TokenPair): Promise { }).then(async (res: FetchResponse) => { if (res.status == 200) { var data = await (res.json() as Promise); - console.log(data) tokens.access_token = data.access_token; tokens.refresh_token = data.refresh_token; return true; @@ -43,10 +42,16 @@ export async function apiRequest(tokens: TokenPair, endpoint: string): Promise < } else { if (refreshApiToken(tokens)) { return fetch("https://api.twitch.tv/helix" + endpoint, { headers: headers }) - .then((res: FetchResponse) => { + .then(async (res: FetchResponse) => { if (res.status == 200) { return res.json(); } else { + console.log("Failed API request:"); + console.log("Request URL: https://api.twitch.tv/helix" + endpoint); + console.log("Headers: "); + console.log(headers); + console.log("Response: "); + console.log(await res.json()); return false; } })