mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-26 12:21:03 +00:00
fix: fixing bottom panel scss
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user