Files
hydra/src/main/events/catalogue/get-trending-games.ts
Chubby Granny Chaser 79498abdb5
Some checks failed
Release / build (ubuntu-latest) (push) Has been cancelled
Release / build (windows-2022) (push) Has been cancelled
feat: improving ui for download source filter
2025-09-30 20:37:44 +01:00

23 lines
658 B
TypeScript

import { db, levelKeys } from "@main/level";
import { registerEvent } from "../register-event";
import { HydraApi } from "@main/services";
import type { TrendingGame } from "@types";
const getTrendingGames = async (_event: Electron.IpcMainInvokeEvent) => {
const language = await db
.get<string, string>(levelKeys.language, {
valueEncoding: "utf8",
})
.then((language) => language || "en");
const trendingGames = await HydraApi.get<TrendingGame[]>(
"/catalogue/featured",
{ language },
{ needsAuth: false }
).catch(() => []);
return trendingGames.slice(0, 1);
};
registerEvent("getTrendingGames", getTrendingGames);