feat: adjustments

This commit is contained in:
Zamitto 2024-09-29 16:45:51 -03:00
parent a48e269d7f
commit a031049b73
3 changed files with 22 additions and 26 deletions

View File

@ -9,13 +9,9 @@ export const getGameAchievementData = async (
where: { id: 1 }, where: { id: 1 },
}); });
return HydraApi.get( return HydraApi.get("/games/achievements", {
"/games/achievements", shop,
{ objectId,
shop, language: userPreferences?.language || "en",
objectId, });
language: userPreferences?.language || "en",
},
{ needsAuth: false }
);
}; };

View File

@ -8,14 +8,22 @@ const saveAchievementsOnLocal = async (
shop: string, shop: string,
achievements: any[] achievements: any[]
) => { ) => {
return gameAchievementRepository.upsert( return gameAchievementRepository
{ .upsert(
objectId, {
shop, objectId,
unlockedAchievements: JSON.stringify(achievements), shop,
}, unlockedAchievements: JSON.stringify(achievements),
["objectId", "shop"] },
); ["objectId", "shop"]
)
.then(() => {
WindowManager.mainWindow?.webContents.send(
"on-achievement-unlocked",
objectId,
shop
);
});
}; };
export const mergeAchievements = async ( export const mergeAchievements = async (
@ -62,14 +70,6 @@ export const mergeAchievements = async (
return achievement.name === steamAchievement.name; return achievement.name === steamAchievement.name;
}); });
WindowManager.mainWindow?.webContents.send(
"on-achievement-unlocked",
objectId,
shop,
achievementInfo.displayName,
achievementInfo.icon
);
if (publishNotification) { if (publishNotification) {
WindowManager.notificationWindow?.webContents.send( WindowManager.notificationWindow?.webContents.send(
"on-achievement-unlocked", "on-achievement-unlocked",

View File

@ -42,7 +42,7 @@ export const updateLocalUnlockedAchivements = async (
["objectId", "shop"] ["objectId", "shop"]
); );
}) })
.catch(console.log); .catch(() => {});
} }
const unlockedAchievements: UnlockedAchievement[] = []; const unlockedAchievements: UnlockedAchievement[] = [];