feat: allow manual unlocks in learn missions

This commit is contained in:
Remi
2025-09-22 07:38:46 +02:00
committed by itsrubberduck
parent 46ece5e5c0
commit 3c12f6d836
4 changed files with 31 additions and 0 deletions

View File

@@ -15,10 +15,14 @@ export default defineEventHandler(async (event) => {
profile.progress && typeof profile.progress === 'object'
? JSON.parse(JSON.stringify(profile.progress))
: {}
const unlockedModules = Array.isArray(profile.unlockedModules)
? Array.from(new Set((profile.unlockedModules as unknown[]).filter(item => typeof item === 'string').map(item => item.trim())))
: []
return {
xp: typeof profile.xp === 'number' ? profile.xp : 0,
progress,
config,
unlockedModules,
}
})