feat: get iconUrl

This commit is contained in:
Zamitto
2024-06-13 00:39:11 -03:00
parent c8fa8f99d2
commit 6b2549ed13
4 changed files with 34 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import { HydraApi } from "@main/services/hydra-api";
import { steamGamesWorker } from "@main/workers";
import { UserProfile } from "@types";
import { convertSteamGameToCatalogueEntry } from "../helpers/search-games";
import { getSteamAppAsset } from "@main/helpers";
const getUserProfile = async (
_event: Electron.IpcMainInvokeEvent,
@@ -19,8 +20,11 @@ const getUserProfile = async (
const steamGame = await steamGamesWorker.run(Number(game.objectId), {
name: "getById",
});
const iconUrl = steamGame?.clientIcon
? getSteamAppAsset("icon", game.objectId, steamGame.clientIcon)
: null;
return convertSteamGameToCatalogueEntry(steamGame);
return { ...convertSteamGameToCatalogueEntry(steamGame), iconUrl };
})
);
@@ -29,7 +33,11 @@ const getUserProfile = async (
const steamGame = await steamGamesWorker.run(Number(game.objectId), {
name: "getById",
});
return convertSteamGameToCatalogueEntry(steamGame);
const iconUrl = steamGame?.clientIcon
? getSteamAppAsset("icon", game.objectId, steamGame.clientIcon)
: null;
return { ...convertSteamGameToCatalogueEntry(steamGame), iconUrl };
})
);