mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +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 { registerEvent } from "../register-event";
|
||||||
import { searchGames } from "../helpers/search-games";
|
import { searchGames } from "../helpers/search-games";
|
||||||
|
import { CatalogueEntry } from "@types";
|
||||||
|
|
||||||
registerEvent(
|
const searchGamesEvent = async (
|
||||||
(_event: Electron.IpcMainInvokeEvent, query: string) =>
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
searchGames({ query, take: 12 }),
|
query: string
|
||||||
{
|
): Promise<CatalogueEntry[]> => {
|
||||||
|
return Promise.all(searchGames({ query, take: 12 }));
|
||||||
|
};
|
||||||
|
|
||||||
|
registerEvent(searchGamesEvent, {
|
||||||
name: "searchGames",
|
name: "searchGames",
|
||||||
memoize: true,
|
memoize: true,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ export interface SearchGamesArgs {
|
||||||
skip?: number;
|
skip?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this function really needed to be an async function
|
|
||||||
export const searchGames = ({
|
export const searchGames = ({
|
||||||
query,
|
query,
|
||||||
take,
|
take,
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const requestSteam250 = async (path: string) => {
|
||||||
})
|
})
|
||||||
.filter((game) => game != null);
|
.filter((game) => game != null);
|
||||||
})
|
})
|
||||||
.catch((_) => []);
|
.catch((_) => [] as Steam250Game[]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const steam250Paths = [
|
const steam250Paths = [
|
||||||
|
|
Loading…
Reference in a new issue