feat: Tick all levels that the user has completed

This commit is contained in:
Alexander Polynomdivision
2018-10-02 16:04:38 +02:00
parent d6f5ef4cc5
commit 26407b6cb7
5 changed files with 23 additions and 9 deletions

View File

@@ -30,6 +30,9 @@ userRouter.get("/me", async (req: LRequest, res) => {
delete copy._id;
delete copy.hash;
delete copy.salt;
delete copy.lastReview;
delete copy.lastLevel;
delete copy.vocabMetadata;
res.send({
error: "0",

View File

@@ -27,15 +27,19 @@ export async function performLogin(username: string, password: string, db: Db):
token: sessionToken,
});
return {
username: user.username,
uid: user.uid,
showWelcome: user.showWelcome,
score: user.score,
classId: user.classId,
// Return the user, but remove all undeeded data
let copy = Object.assign({}, user, {
sessionToken,
};
});
delete copy._id;
delete copy.hash;
delete copy.salt;
delete copy.lastReview;
delete copy.lastLevel;
delete copy.vocabMetadata;
return copy;
} else {
// It does not matter what we throw
throw new Error("LOL");