From 735b540af42295f5409fdc2420495d89c1486112 Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Sun, 20 Oct 2024 18:11:13 +0100 Subject: [PATCH] feat: adding console.log --- .../cloud-save/get-game-backup-preview.ts | 1 - .../achievements/achievement-watcher.ts | 10 +- .../update-local-unlocked-achivements.ts | 2 +- src/main/services/hydra-api.ts | 108 +++++++++--------- .../components/bottom-panel/bottom-panel.tsx | 4 +- .../upload-background-image-button.tsx | 2 +- 6 files changed, 63 insertions(+), 64 deletions(-) diff --git a/src/main/events/cloud-save/get-game-backup-preview.ts b/src/main/events/cloud-save/get-game-backup-preview.ts index ee95059f..433fccc4 100644 --- a/src/main/events/cloud-save/get-game-backup-preview.ts +++ b/src/main/events/cloud-save/get-game-backup-preview.ts @@ -11,7 +11,6 @@ const getGameBackupPreview = async ( ) => { const backupPath = path.join(backupsPath, `${shop}-${objectId}`); - console.log("preview invoked>>"); return Ludusavi.getBackupPreview(shop, objectId, backupPath); }; diff --git a/src/main/services/achievements/achievement-watcher.ts b/src/main/services/achievements/achievement-watcher.ts index d625a927..ac078468 100644 --- a/src/main/services/achievements/achievement-watcher.ts +++ b/src/main/services/achievements/achievement-watcher.ts @@ -36,11 +36,11 @@ export const watchAchievements = async () => { if (!gameAchievementFiles.length) continue; - // console.log( - // "Achievements files to observe for:", - // game.title, - // gameAchievementFiles - // ); + console.log( + "Achievements files to observe for:", + game.title, + gameAchievementFiles + ); for (const file of gameAchievementFiles) { compareFile(game, file); diff --git a/src/main/services/achievements/update-local-unlocked-achivements.ts b/src/main/services/achievements/update-local-unlocked-achivements.ts index a11c3487..13f33fcd 100644 --- a/src/main/services/achievements/update-local-unlocked-achivements.ts +++ b/src/main/services/achievements/update-local-unlocked-achivements.ts @@ -72,7 +72,7 @@ export const updateLocalUnlockedAchivements = async (game: Game) => { gameAchievementFiles.push(...achievementFileInsideDirectory); - // console.log("Achievements files for", game.title, gameAchievementFiles); + console.log("Achievements files for", game.title, gameAchievementFiles); const unlockedAchievements: UnlockedAchievement[] = []; diff --git a/src/main/services/hydra-api.ts b/src/main/services/hydra-api.ts index 4ae6a32e..f5c241fc 100644 --- a/src/main/services/hydra-api.ts +++ b/src/main/services/hydra-api.ts @@ -12,7 +12,7 @@ import { UserNotLoggedInError, UserWithoutCloudSubscriptionError, } from "@shared"; -// import { omit } from "lodash-es"; +import { omit } from "lodash-es"; import { appVersion } from "@main/constants"; interface HydraApiOptions { @@ -109,59 +109,59 @@ export class HydraApi { }); if (this.ADD_LOG_INTERCEPTOR) { - // this.instance.interceptors.request.use( - // (request) => { - // logger.log(" ---- REQUEST -----"); - // const data = Array.isArray(request.data) - // ? request.data - // : omit(request.data, ["refreshToken"]); - // logger.log(request.method, request.url, request.params, data); - // return request; - // }, - // (error) => { - // logger.error("request error", error); - // return Promise.reject(error); - // } - // ); - // this.instance.interceptors.response.use( - // (response) => { - // logger.log(" ---- RESPONSE -----"); - // const data = Array.isArray(response.data) - // ? response.data - // : omit(response.data, ["username", "accessToken", "refreshToken"]); - // logger.log( - // response.status, - // response.config.method, - // response.config.url, - // data - // ); - // return response; - // }, - // (error) => { - // logger.error(" ---- RESPONSE ERROR -----"); - // const { config } = error; - // logger.error( - // config.method, - // config.baseURL, - // config.url, - // config.headers, - // config.data - // ); - // if (error.response) { - // logger.error( - // "Response", - // error.response.status, - // error.response.data - // ); - // } else if (error.request) { - // logger.error("Request", error.request); - // } else { - // logger.error("Error", error.message); - // } - // logger.error(" ----- END RESPONSE ERROR -------"); - // return Promise.reject(error); - // } - // ); + this.instance.interceptors.request.use( + (request) => { + logger.log(" ---- REQUEST -----"); + const data = Array.isArray(request.data) + ? request.data + : omit(request.data, ["refreshToken"]); + logger.log(request.method, request.url, request.params, data); + return request; + }, + (error) => { + logger.error("request error", error); + return Promise.reject(error); + } + ); + this.instance.interceptors.response.use( + (response) => { + logger.log(" ---- RESPONSE -----"); + const data = Array.isArray(response.data) + ? response.data + : omit(response.data, ["username", "accessToken", "refreshToken"]); + logger.log( + response.status, + response.config.method, + response.config.url, + data + ); + return response; + }, + (error) => { + logger.error(" ---- RESPONSE ERROR -----"); + const { config } = error; + logger.error( + config.method, + config.baseURL, + config.url, + config.headers, + config.data + ); + if (error.response) { + logger.error( + "Response", + error.response.status, + error.response.data + ); + } else if (error.request) { + logger.error("Request", error.request); + } else { + logger.error("Error", error.message); + } + logger.error(" ----- END RESPONSE ERROR -------"); + return Promise.reject(error); + } + ); } const userAuth = await userAuthRepository.findOne({ diff --git a/src/renderer/src/components/bottom-panel/bottom-panel.tsx b/src/renderer/src/components/bottom-panel/bottom-panel.tsx index 0d28a26e..045158a5 100644 --- a/src/renderer/src/components/bottom-panel/bottom-panel.tsx +++ b/src/renderer/src/components/bottom-panel/bottom-panel.tsx @@ -81,10 +81,10 @@ export function BottomPanel() { {status} - + {/* {sessionHash ? `${sessionHash} -` : ""} v{version} " {VERSION_CODENAME}" - + */} ); } diff --git a/src/renderer/src/pages/profile/upload-background-image-button/upload-background-image-button.tsx b/src/renderer/src/pages/profile/upload-background-image-button/upload-background-image-button.tsx index d0b1e013..a11c9069 100644 --- a/src/renderer/src/pages/profile/upload-background-image-button/upload-background-image-button.tsx +++ b/src/renderer/src/pages/profile/upload-background-image-button/upload-background-image-button.tsx @@ -54,7 +54,7 @@ export function UploadBackgroundImageButton() { disabled={isUploadingBackgroundImage} > - {isUploadingBackgroundImage ? "Uploading..." : "Upload background"} + {isUploadingBackgroundImage ? "Uploading..." : "Atualizar banner"} ); }