Chap03 -> Implementing component state (Change getUnansweredQuestions to async function, result failure in transpiling)
parent
5d7f817620
commit
de5bc7f437
|
@ -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);
|
||||
};
|
||||
|
||||
const wait = (ms: number): Promise<void> => {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
Loading…
Reference in New Issue