feat: adjustment update achievements on api

This commit is contained in:
Zamitto 2024-09-29 16:24:57 -03:00
parent 333b143b17
commit a48e269d7f
2 changed files with 12 additions and 5 deletions

View file

@ -67,7 +67,7 @@ const getGameAchievements = async (
return {
...achievement,
unlocked: true,
unlockTime: unlockedAchiement.unlockTime * 1000,
unlockTime: unlockedAchiement.unlockTime,
};
}

View file

@ -41,11 +41,18 @@ export const mergeAchievements = async (
localGameAchievement?.unlockedAchievements || "[]"
);
const newAchievements = achievements.filter((achievement) => {
return !unlockedAchievements.some((localAchievement) => {
return localAchievement.name === achievement.name;
const newAchievements = achievements
.filter((achievement) => {
return !unlockedAchievements.some((localAchievement) => {
return localAchievement.name === achievement.name;
});
})
.map((achievement) => {
return {
...achievement,
unlockTime: achievement.unlockTime * 1000,
};
});
});
if (newAchievements.length) {
const achievement = newAchievements.at(-1)!;