mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-13 11:42:10 +00:00
make sure the registed event for seachGames returns a Promise
This commit is contained in:
parent
013aa20745
commit
2a63d1f7ca
3 changed files with 13 additions and 10 deletions
|
@ -1,11 +1,15 @@
|
|||
import { registerEvent } from "../register-event";
|
||||
import { searchGames } from "../helpers/search-games";
|
||||
import { CatalogueEntry } from "@types";
|
||||
|
||||
registerEvent(
|
||||
(_event: Electron.IpcMainInvokeEvent, query: string) =>
|
||||
searchGames({ query, take: 12 }),
|
||||
{
|
||||
const searchGamesEvent = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
query: string
|
||||
): Promise<CatalogueEntry[]> => {
|
||||
return Promise.all(searchGames({ query, take: 12 }));
|
||||
};
|
||||
|
||||
registerEvent(searchGamesEvent, {
|
||||
name: "searchGames",
|
||||
memoize: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -42,7 +42,6 @@ export interface SearchGamesArgs {
|
|||
skip?: number;
|
||||
}
|
||||
|
||||
// Check if this function really needed to be an async function
|
||||
export const searchGames = ({
|
||||
query,
|
||||
take,
|
||||
|
|
|
@ -25,7 +25,7 @@ export const requestSteam250 = async (path: string) => {
|
|||
})
|
||||
.filter((game) => game != null);
|
||||
})
|
||||
.catch((_) => []);
|
||||
.catch((_) => [] as Steam250Game[]);
|
||||
};
|
||||
|
||||
const steam250Paths = [
|
||||
|
|
Loading…
Reference in a new issue