feat: refactor

This commit is contained in:
Zamitto 2024-07-02 15:42:23 -03:00
parent c9c585f820
commit b8bd786c45
2 changed files with 69 additions and 71 deletions

View File

@ -4,10 +4,9 @@ import { steamGamesWorker } from "@main/workers";
import { getSteamAppAsset } from "@main/helpers"; import { getSteamAppAsset } from "@main/helpers";
export const mergeWithRemoteGames = async () => { export const mergeWithRemoteGames = async () => {
try { return HydraApi.get("/games")
const games = await HydraApi.get("/games"); .then(async (response) => {
for (const game of response.data) {
for (const game of games.data) {
const localGame = await gameRepository.findOne({ const localGame = await gameRepository.findOne({
where: { where: {
objectID: game.objectId, objectID: game.objectId,
@ -60,5 +59,6 @@ export const mergeWithRemoteGames = async () => {
} }
} }
} }
} catch (err) {} })
.catch();
}; };

View File

@ -6,7 +6,6 @@ import { mergeWithRemoteGames } from "./merge-with-remote-games";
import { WindowManager } from "../window-manager"; import { WindowManager } from "../window-manager";
export const uploadGamesBatch = async () => { export const uploadGamesBatch = async () => {
try {
const games = await gameRepository.find({ const games = await gameRepository.find({
where: { remoteId: IsNull(), isDeleted: false }, where: { remoteId: IsNull(), isDeleted: false },
}); });
@ -31,5 +30,4 @@ export const uploadGamesBatch = async () => {
if (WindowManager.mainWindow) if (WindowManager.mainWindow)
WindowManager.mainWindow.webContents.send("on-library-batch-complete"); WindowManager.mainWindow.webContents.send("on-library-batch-complete");
} catch (err) {}
}; };