fix: fixing bottom panel scss

This commit is contained in:
Chubby Granny Chaser
2024-11-28 10:13:23 +00:00
parent f66bdd706b
commit f35c34fa63
10 changed files with 78 additions and 152 deletions

View File

@@ -1,23 +1,21 @@
import type { HowLongToBeatCategory } from "@types";
import { getHowLongToBeatGame, searchHowLongToBeat } from "@main/services";
import type { GameShop, HowLongToBeatCategory } from "@types";
import { HydraApi } from "@main/services";
import { registerEvent } from "../register-event";
import { formatName } from "@shared";
const getHowLongToBeat = async (
_event: Electron.IpcMainInvokeEvent,
title: string
shop: GameShop,
objectId: string
): Promise<HowLongToBeatCategory[] | null> => {
const response = await searchHowLongToBeat(title);
const game = response.data.find((game) => {
return formatName(game.game_name) === formatName(title);
const params = new URLSearchParams({
shop,
objectId: objectId.toString(),
});
if (!game) return null;
const howLongToBeat = await getHowLongToBeatGame(String(game.game_id));
return howLongToBeat;
return HydraApi.get(`/games/how-long-to-beat?${params.toString()}`, null, {
needsAuth: false,
});
};
registerEvent("getHowLongToBeat", getHowLongToBeat);