fix: Make getReviewQueue a Promise

This commit is contained in:
Alexander Polynomdivision 2018-09-19 18:06:59 +02:00
parent 8a6ec0dbc7
commit fbb27b8947
2 changed files with 32 additions and 25 deletions

View File

@ -72,11 +72,14 @@ export default class Application extends React.Component<IProps> {
});
}
getReviewQueue = (): IVocab[] => {
getReviewQueue = (): Promise<IVocab[]> => {
console.log("STUB: Application::getReviewQueue");
// TODO: Implement
return [{
return new Promise((res, rej) => {
setTimeout(() => {
res([
{
german: ["Wein"],
hint: "Worte auf '-um' sind meistens NeutrUM",
type: VocabType.NOMEN,
@ -99,7 +102,10 @@ export default class Application extends React.Component<IProps> {
* hint: "Worte auf \"-a\" sind FeminA",
* type: VocabType.NOMEN,
* id: 3
} */] as IVocab[];
} */
]);
}, 2000);
});
}
getLearners(): ILearner[] {

View File

@ -86,6 +86,7 @@ const ReviewPageWithRouter = withRouter(
[ReviewType.LEVEL]: () => vocabByLevelW(levelId),
[ReviewType.QUEUE]: () => vocabByQueueW(),
}[reviewType];
getVocab().then((res: IVocab[]) => {
this.vocab = res;
vocToQueue();