From 8e71aa85dc76fd1e162c5c52191fccba846edb98 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Mon, 1 Oct 2018 17:31:23 +0200 Subject: [PATCH] fix: The client and server send the ILevel type differently --- backend/src/main.ts | 10 ++++++++-- frontend/src/models/level.ts | 2 +- frontend/src/pages/dashboard.tsx | 2 +- frontend/src/pages/levelList.tsx | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/src/main.ts b/backend/src/main.ts index 7e1339b..dbbabf1 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -52,11 +52,17 @@ const assert = require('assert'); app.use("/api/user", UserRouter); app.get("/api/levels", async (req, res) => { // TODO: if (levels) - const levels = (await db.collection("levels").find() + const levels = (await db.collection("levels").find({}, { + // The order in which we send the levels is important, so better + // sort them + sort: { + level: 1, + }, + }) .toArray()) .map((el) => { let tmp = Object.assign({}, el); - delete tmp.queue; + delete tmp.vocab; delete tmp._id; return tmp; diff --git a/frontend/src/models/level.ts b/frontend/src/models/level.ts index bff86a0..7410875 100644 --- a/frontend/src/models/level.ts +++ b/frontend/src/models/level.ts @@ -1,6 +1,6 @@ export interface ILevel { name: string; - desc: string; + description: string; level: number; done: boolean; diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsx index 27613b0..de6adc9 100644 --- a/frontend/src/pages/dashboard.tsx +++ b/frontend/src/pages/dashboard.tsx @@ -74,7 +74,7 @@ export default class Dashboard extends React.Component { {level.name}
- {level.desc} + {level.description}