Chap03 -> Implementing component state (Change getUnansweredQuestions to async function, result failure in transpiling)
parent
072b7dcf88
commit
cdecba7c2e
|
@ -48,6 +48,11 @@ const questions: QuestionData[] = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const getUnansweredQuestions = (): QuestionData[] => {
|
export const getUnansweredQuestions = async(): Promise<QuestionData[]> => {
|
||||||
|
await wait(500);
|
||||||
return questions.filter((q) => q.answers.length === 0);
|
return questions.filter((q) => q.answers.length === 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const wait = (ms: number): Promise<void> => {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
}
|
Loading…
Reference in New Issue