feat: Implement the new /dashboard API
This commit is contained in:
@@ -114,16 +114,35 @@ userRouter.post("/level/:id", async (req, res) => {
|
||||
});
|
||||
|
||||
// Get the data needed for the dashboard
|
||||
userRouter.post("/dashboard", async (req, res) => {
|
||||
userRouter.get("/dashboard", async (req, res) => {
|
||||
console.log("STUB(post): /user/dashboard");
|
||||
|
||||
let users: any[] = [];
|
||||
let nr = 10;
|
||||
for (let i = 0; i < 10; i++)
|
||||
users = users.concat({
|
||||
username: `Test User ${i}`,
|
||||
score: 100 * i,
|
||||
level: Math.floor(Math.random() * Math.floor(10)),
|
||||
nr: nr--,
|
||||
});
|
||||
|
||||
// TODO: Stub
|
||||
res.send({
|
||||
error: "0",
|
||||
error: "200",
|
||||
data: {
|
||||
nextLevel: {},
|
||||
topTen: {},
|
||||
lastReview: {},
|
||||
nextLevel: {
|
||||
name: "Test level",
|
||||
desc: "Just a test",
|
||||
level: 3,
|
||||
|
||||
done: false,
|
||||
},
|
||||
topTen: users,
|
||||
lastReview: {
|
||||
correct: 0,
|
||||
wrong: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user