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 { return {
...achievement, ...achievement,
unlocked: true, unlocked: true,
unlockTime: unlockedAchiement.unlockTime * 1000, unlockTime: unlockedAchiement.unlockTime,
}; };
} }

View file

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