From 431772d76a6d682242a38a14258bdf120090d7af Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:12:26 +0200 Subject: [PATCH] simpler local request paths, remove logging --- backend/api-renamed/status/pat-info.js | 19 +++++++------------ backend/src/common/utils.js | 20 ++++++-------------- frontend/frontend/src/pages/Home/Home.js | 6 +++--- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/backend/api-renamed/status/pat-info.js b/backend/api-renamed/status/pat-info.js index 43c6fc39..8b15d76b 100644 --- a/backend/api-renamed/status/pat-info.js +++ b/backend/api-renamed/status/pat-info.js @@ -141,19 +141,14 @@ export default async (_, res) => { res.setHeader("Content-Type", "application/json"); try { // Add header to prevent abuse. - try { - const PATsInfo = await getPATInfo(uptimeFetcher, {}); - if (PATsInfo) { - res.setHeader( - "Cache-Control", - `max-age=0, s-maxage=${RATE_LIMIT_SECONDS}`, - ); - } - res.send(JSON.stringify(PATsInfo, null, 2)); - console.log("pat-info done"); - } catch (e) { - console.log("pat-info exception:", e); + const PATsInfo = await getPATInfo(uptimeFetcher, {}); + if (PATsInfo) { + res.setHeader( + "Cache-Control", + `max-age=0, s-maxage=${RATE_LIMIT_SECONDS}`, + ); } + res.send(JSON.stringify(PATsInfo, null, 2)); } catch (err) { // Throw error if something went wrong. logger.error(err); diff --git a/backend/src/common/utils.js b/backend/src/common/utils.js index 10b171f0..046c7fc7 100644 --- a/backend/src/common/utils.js +++ b/backend/src/common/utils.js @@ -248,20 +248,12 @@ const buildSearchFilter = (repos = [], owners = []) => { * @returns {Promise} Request response. */ const request = (data, headers) => { - console.log("making request with: " + JSON.stringify(headers) + " | " + JSON.stringify(data)); - try { - let response = axios({ - url: "https://api.github.com/graphql", - method: "post", - headers, - data, - }); - console.log("response: ", response); - return response; - } catch (e) { - console.log("request exception:", e); - return null; - } + return axios({ + url: "https://api.github.com/graphql", + method: "post", + headers, + data, + }); }; /** diff --git a/frontend/frontend/src/pages/Home/Home.js b/frontend/frontend/src/pages/Home/Home.js index b8893412..1c26a49b 100644 --- a/frontend/frontend/src/pages/Home/Home.js +++ b/frontend/frontend/src/pages/Home/Home.js @@ -155,12 +155,12 @@ const HomeScreen = () => { await testEndpoint('/api?username=martin-mfg'); await testEndpoint('/api/gist?id=bbfce31e0217a3689c8d961a356cb10d'); await testEndpoint( - '/api/pin/?username=martin-mfg&repo=openapi-generator', + '/api/pin?username=martin-mfg&repo=openapi-generator', ); await testEndpoint( - '/api/top-langs/?username=anuraghazra&langs_count=4', + '/api/top-langs?username=anuraghazra&langs_count=4', ); - await testEndpoint('/api/wakatime/?username=ffflabs'); + await testEndpoint('/api/wakatime?username=ffflabs'); console.log('PAT_1: ', process.env.PAT_1); // console.log(router); /*