mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: changing get random game to work with shop block
This commit is contained in:
parent
2475d48bc4
commit
5ab51e4547
6 changed files with 58 additions and 42 deletions
|
|
@ -1,9 +1,10 @@
|
|||
import { shuffle } from "lodash-es";
|
||||
|
||||
import { Steam250Game, getSteam250List } from "@main/services";
|
||||
import { getSteam250List } from "@main/services";
|
||||
|
||||
import { registerEvent } from "../register-event";
|
||||
import { searchGames, searchRepacks } from "../helpers/search-games";
|
||||
import type { Steam250Game } from "@types";
|
||||
|
||||
const state = { games: Array<Steam250Game>(), index: 0 };
|
||||
|
||||
|
|
@ -25,8 +26,6 @@ const getRandomGame = async (_event: Electron.IpcMainInvokeEvent) => {
|
|||
return "";
|
||||
}
|
||||
|
||||
const resultObjectId = state.games[state.index].objectID;
|
||||
|
||||
state.index += 1;
|
||||
|
||||
if (state.index == state.games.length) {
|
||||
|
|
@ -34,7 +33,7 @@ const getRandomGame = async (_event: Electron.IpcMainInvokeEvent) => {
|
|||
state.games = shuffle(state.games);
|
||||
}
|
||||
|
||||
return resultObjectId;
|
||||
return state.games[state.index];
|
||||
};
|
||||
|
||||
registerEvent(getRandomGame, {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import axios from "axios";
|
||||
import { JSDOM } from "jsdom";
|
||||
|
||||
export interface Steam250Game {
|
||||
title: string;
|
||||
objectID: string;
|
||||
}
|
||||
import type { Steam250Game } from "@types";
|
||||
|
||||
export const requestSteam250 = async (path: string) => {
|
||||
return axios
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue