mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 02:41:02 +00:00
feat: improving ui for download source filter
This commit is contained in:
@@ -21,11 +21,9 @@ const getGameStats = async (
|
||||
return cachedStats;
|
||||
}
|
||||
|
||||
return HydraApi.get<GameStats>(
|
||||
`/games/stats`,
|
||||
{ objectId, shop },
|
||||
{ needsAuth: false }
|
||||
).then(async (data) => {
|
||||
return HydraApi.get<GameStats>(`/games/${shop}/${objectId}/stats`, null, {
|
||||
needsAuth: false,
|
||||
}).then(async (data) => {
|
||||
await gamesStatsCacheSublevel.put(levelKeys.game(shop, objectId), {
|
||||
...data,
|
||||
updatedAt: Date.now(),
|
||||
|
||||
@@ -8,12 +8,7 @@ const getHowLongToBeat = async (
|
||||
objectId: string,
|
||||
shop: GameShop
|
||||
): Promise<HowLongToBeatCategory[] | null> => {
|
||||
const params = new URLSearchParams({
|
||||
objectId,
|
||||
shop,
|
||||
});
|
||||
|
||||
return HydraApi.get(`/games/how-long-to-beat?${params.toString()}`, null, {
|
||||
return HydraApi.get(`/games/${shop}/${objectId}/how-long-to-beat`, null, {
|
||||
needsAuth: false,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ const getTrendingGames = async (_event: Electron.IpcMainInvokeEvent) => {
|
||||
.then((language) => language || "en");
|
||||
|
||||
const trendingGames = await HydraApi.get<TrendingGame[]>(
|
||||
"/games/featured",
|
||||
"/catalogue/featured",
|
||||
{ language },
|
||||
{ needsAuth: false }
|
||||
).catch(() => []);
|
||||
|
||||
@@ -87,7 +87,7 @@ const createSteamShortcut = async (
|
||||
}
|
||||
|
||||
const { assets } = await HydraApi.get<GameStats>(
|
||||
`/games/stats?objectId=${objectId}&shop=${shop}`
|
||||
`/games/${shop}/${objectId}/stats`
|
||||
);
|
||||
|
||||
const steamUserIds = await getSteamUsersIds();
|
||||
|
||||
@@ -93,14 +93,9 @@ const startGameDownload = async (
|
||||
|
||||
await Promise.all([
|
||||
createGame(updatedGame!).catch(() => {}),
|
||||
HydraApi.post(
|
||||
"/games/download",
|
||||
{
|
||||
objectId,
|
||||
shop,
|
||||
},
|
||||
{ needsAuth: false }
|
||||
).catch(() => {}),
|
||||
HydraApi.post(`/games/${shop}/${objectId}/download`, null, {
|
||||
needsAuth: false,
|
||||
}).catch(() => {}),
|
||||
]);
|
||||
|
||||
return { ok: true };
|
||||
|
||||
@@ -45,10 +45,8 @@ export const getGameAchievementData = async (
|
||||
.then((language) => language || "en");
|
||||
|
||||
return HydraApi.get<SteamAchievement[]>(
|
||||
"/games/achievements",
|
||||
`/games/${shop}/${objectId}/achievements`,
|
||||
{
|
||||
shop,
|
||||
objectId,
|
||||
language,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -16,9 +16,7 @@ export const friendGameSessionEvent = async (payload: FriendGameSession) => {
|
||||
|
||||
const [friend, gameStats] = await Promise.all([
|
||||
HydraApi.get<UserProfile>(`/users/${payload.friendId}`),
|
||||
HydraApi.get<GameStats>(
|
||||
`/games/stats?objectId=${payload.objectId}&shop=steam`
|
||||
),
|
||||
HydraApi.get<GameStats>(`/games/steam/${payload.objectId}/stats`),
|
||||
]).catch(() => [null, null]);
|
||||
|
||||
if (friend && gameStats) {
|
||||
|
||||
Reference in New Issue
Block a user