fix: The client and server send the ILevel type differently
This commit is contained in:
parent
9144676ec2
commit
8e71aa85dc
@ -52,11 +52,17 @@ const assert = require('assert');
|
|||||||
app.use("/api/user", UserRouter);
|
app.use("/api/user", UserRouter);
|
||||||
app.get("/api/levels", async (req, res) => {
|
app.get("/api/levels", async (req, res) => {
|
||||||
// TODO: if (levels)
|
// 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())
|
.toArray())
|
||||||
.map((el) => {
|
.map((el) => {
|
||||||
let tmp = Object.assign({}, el);
|
let tmp = Object.assign({}, el);
|
||||||
delete tmp.queue;
|
delete tmp.vocab;
|
||||||
delete tmp._id;
|
delete tmp._id;
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export interface ILevel {
|
export interface ILevel {
|
||||||
name: string;
|
name: string;
|
||||||
desc: string;
|
description: string;
|
||||||
level: number;
|
level: number;
|
||||||
|
|
||||||
done: boolean;
|
done: boolean;
|
||||||
|
@ -74,7 +74,7 @@ export default class Dashboard extends React.Component<IProps> {
|
|||||||
<Typography variant="title" component="p">{level.name}</Typography>
|
<Typography variant="title" component="p">{level.name}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography component="p">
|
<Typography component="p">
|
||||||
{level.desc}
|
{level.description}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button
|
<Button
|
||||||
component={Link}
|
component={Link}
|
||||||
|
@ -68,7 +68,7 @@ export default class Dashboard extends React.Component<IProps> {
|
|||||||
<Typography variant="title" component="p">{level.name}</Typography>
|
<Typography variant="title" component="p">{level.name}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography component="p">
|
<Typography component="p">
|
||||||
{level.desc}
|
{level.description}
|
||||||
</Typography>
|
</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions>
|
<CardActions>
|
||||||
|
Reference in New Issue
Block a user