diff --git a/frontend/src/pages/level.tsx b/frontend/src/pages/level.tsx index c6087fb..f85f94b 100644 --- a/frontend/src/pages/level.tsx +++ b/frontend/src/pages/level.tsx @@ -50,6 +50,7 @@ const LevelPageWithRouter = withRouter( this.props.levelVocab(this.props.id).then(vocab => { this.props.setVocab(vocab); this.props.setCurrentVocab(vocab[0]); + this.props.setLookedAt([vocab[0].id]); this.props.setLoading(false); }); @@ -68,7 +69,7 @@ const LevelPageWithRouter = withRouter( renderVocabListItem = (vocab: IVocab): any => { // Check if the vocab was already looked at - const lookedAt = this.props.lookedAt.find((el) => el === vocab.id) || vocab.id === 0; + const lookedAt = this.props.lookedAt.find((el) => el === vocab.id); return { // Prevent the user from using too much memory by always clicking on the elements @@ -87,6 +88,9 @@ const LevelPageWithRouter = withRouter( toReview = () => { const { vocab, lookedAt, id } = this.props; + + console.log(this.props); + // Only go to the review if all vocabulary item have been looked at if (vocab.length === lookedAt.length) { this.props.updateDoneLevels(id);