Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #339 from MichaelKohler/feature/fix-review-one-lan…
Browse files Browse the repository at this point in the history
…guage

fix: correctly set language if user only has one language
  • Loading branch information
MichaelKohler committed Oct 12, 2020
2 parents e51d305 + ee76c66 commit 277e570
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions web/src/components/pages/review.js
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Link, Redirect } from 'react-router-dom';
import { Link } from 'react-router-dom';

import { loadSentences, resetReviewMessage, reviewSentences } from '../../actions/sentences';
import LanguageSelector from '../language-selector';
Expand Down Expand Up @@ -35,11 +35,9 @@ export default function Review({ match, history }) {
const { useSwipeReview } = useSelector((state) => state.settings);
const dispatch = useDispatch();

// If user only has one language possible, redirect to it.
// If user only has one language possible, use it.
if (languages.length === 1 && languages[0] !== language) {
return (
<Redirect to={getReviewUrl(languages[0])} />
);
setLanguage(languages[0]);
}

// If user hasn't added any languages, ask them to do so.
Expand Down

0 comments on commit 277e570

Please sign in to comment.