mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
removing async from searchGames
This commit is contained in:
parent
7a48a0202c
commit
8eece72a81
@ -42,11 +42,12 @@ export interface SearchGamesArgs {
|
|||||||
skip?: number;
|
skip?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const searchGames = async ({
|
// Check if this function really needed to be an async function
|
||||||
|
export const searchGames = ({
|
||||||
query,
|
query,
|
||||||
take,
|
take,
|
||||||
skip,
|
skip,
|
||||||
}: SearchGamesArgs): Promise<CatalogueEntry[]> => {
|
}: SearchGamesArgs): CatalogueEntry[] => {
|
||||||
const results = steamGamesIndex
|
const results = steamGamesIndex
|
||||||
.search(formatName(query || ""), { limit: take, offset: skip })
|
.search(formatName(query || ""), { limit: take, offset: skip })
|
||||||
.map((index) => {
|
.map((index) => {
|
||||||
@ -61,11 +62,9 @@ export const searchGames = async ({
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return Promise.all(results).then((resultsWithRepacks) =>
|
return orderBy(
|
||||||
orderBy(
|
results,
|
||||||
resultsWithRepacks,
|
[({ repacks }) => repacks.length, "repacks"],
|
||||||
[({ repacks }) => repacks.length, "repacks"],
|
["desc"]
|
||||||
["desc"]
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -39,10 +39,10 @@ export const getSteam250List = async () => {
|
|||||||
const gamesPromises = steam250Paths.map((path) => requestSteam250(path));
|
const gamesPromises = steam250Paths.map((path) => requestSteam250(path));
|
||||||
const gamesList = (await Promise.all(gamesPromises)).flat();
|
const gamesList = (await Promise.all(gamesPromises)).flat();
|
||||||
|
|
||||||
const gamesMap = gamesList.reduce((map, item) => {
|
const gamesMap: Map<string, Steam250Game> = gamesList.reduce((map, item) => {
|
||||||
map.set(item.objectID, item);
|
map.set(item.objectID, item);
|
||||||
return map;
|
return map;
|
||||||
}, new Map<string, Steam250Game>());
|
}, new Map());
|
||||||
|
|
||||||
return [...gamesMap.values()];
|
return [...gamesMap.values()];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user