mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: refactor achievement listeners
This commit is contained in:
parent
f5445b00f4
commit
63aee44982
6 changed files with 45 additions and 18 deletions
|
|
@ -2,6 +2,7 @@ import { gameAchievementRepository, gameRepository } from "@main/repository";
|
|||
import type { GameShop, UnlockedAchievement } from "@types";
|
||||
import { WindowManager } from "../window-manager";
|
||||
import { HydraApi } from "../hydra-api";
|
||||
import { getGameAchievements } from "@main/events/catalogue/get-game-achievements";
|
||||
|
||||
const saveAchievementsOnLocal = async (
|
||||
objectId: string,
|
||||
|
|
@ -17,11 +18,10 @@ const saveAchievementsOnLocal = async (
|
|||
},
|
||||
["objectId", "shop"]
|
||||
)
|
||||
.then(() => {
|
||||
.then(async () => {
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
"on-achievement-unlocked",
|
||||
objectId,
|
||||
shop
|
||||
`on-update-achievements-${objectId}-${shop}`,
|
||||
await getGameAchievements(objectId, shop as GameShop)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue