mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-25 20:01:03 +00:00
make sure the registed event for seachGames returns a Promise
This commit is contained in:
@@ -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[]> => {
|
||||||
name: "searchGames",
|
return Promise.all(searchGames({ query, take: 12 }));
|
||||||
memoize: true,
|
};
|
||||||
}
|
|
||||||
);
|
registerEvent(searchGamesEvent, {
|
||||||
|
name: "searchGames",
|
||||||
|
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 = [
|
||||||
|
|||||||
Reference in New Issue
Block a user