fix: Fix the level page handling vocab IDs wrongly
This commit is contained in:
parent
adba83f865
commit
2276dad7a7
@ -50,6 +50,7 @@ const LevelPageWithRouter = withRouter(
|
|||||||
this.props.levelVocab(this.props.id).then(vocab => {
|
this.props.levelVocab(this.props.id).then(vocab => {
|
||||||
this.props.setVocab(vocab);
|
this.props.setVocab(vocab);
|
||||||
this.props.setCurrentVocab(vocab[0]);
|
this.props.setCurrentVocab(vocab[0]);
|
||||||
|
this.props.setLookedAt([vocab[0].id]);
|
||||||
this.props.setLoading(false);
|
this.props.setLoading(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ const LevelPageWithRouter = withRouter(
|
|||||||
|
|
||||||
renderVocabListItem = (vocab: IVocab): any => {
|
renderVocabListItem = (vocab: IVocab): any => {
|
||||||
// Check if the vocab was already looked at
|
// 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 <ListItem button key={this.genUID(vocab)} onClick={() => {
|
return <ListItem button key={this.genUID(vocab)} onClick={() => {
|
||||||
// Prevent the user from using too much memory by always clicking on the elements
|
// Prevent the user from using too much memory by always clicking on the elements
|
||||||
@ -87,6 +88,9 @@ const LevelPageWithRouter = withRouter(
|
|||||||
|
|
||||||
toReview = () => {
|
toReview = () => {
|
||||||
const { vocab, lookedAt, id } = this.props;
|
const { vocab, lookedAt, id } = this.props;
|
||||||
|
|
||||||
|
console.log(this.props);
|
||||||
|
|
||||||
// Only go to the review if all vocabulary item have been looked at
|
// Only go to the review if all vocabulary item have been looked at
|
||||||
if (vocab.length === lookedAt.length) {
|
if (vocab.length === lookedAt.length) {
|
||||||
this.props.updateDoneLevels(id);
|
this.props.updateDoneLevels(id);
|
||||||
|
Reference in New Issue
Block a user