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

View File

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