mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
refactor removeGameFromLibrary to handle error
This commit is contained in:
parent
ab4cf23f97
commit
b07451e91d
1 changed files with 7 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { registerEvent } from "../register-event";
|
import { registerEvent } from "../register-event";
|
||||||
import { gameRepository } from "../../repository";
|
import { gameRepository } from "../../repository";
|
||||||
import { HydraApi } from "@main/services/hydra-api";
|
import { HydraApi } from "@main/services/hydra-api";
|
||||||
|
import { logger } from "@main/services";
|
||||||
|
|
||||||
const removeGameFromLibrary = async (
|
const removeGameFromLibrary = async (
|
||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
|
@ -11,6 +12,12 @@ const removeGameFromLibrary = async (
|
||||||
{ isDeleted: true, executablePath: null }
|
{ isDeleted: true, executablePath: null }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
removeRemoveGameFromLibrary(gameId).catch((err) => {
|
||||||
|
logger.error("removeRemoveGameFromLibrary", err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeRemoveGameFromLibrary = async (gameId: number) => {
|
||||||
const game = await gameRepository.findOne({ where: { id: gameId } });
|
const game = await gameRepository.findOne({ where: { id: gameId } });
|
||||||
|
|
||||||
if (game?.remoteId) {
|
if (game?.remoteId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue