diff --git a/QandA/frontend/src/QuestionsData.ts b/QandA/frontend/src/QuestionsData.ts index 8bac88a..4b5fc97 100644 --- a/QandA/frontend/src/QuestionsData.ts +++ b/QandA/frontend/src/QuestionsData.ts @@ -56,3 +56,11 @@ export const getUnansweredQuestions = async (): Promise => { const wait = (ms: number): Promise => { return new Promise((resolve) => setTimeout(resolve, ms)); }; + +export const getQuestion = async ( + questionId: number, +): Promise => { + await wait(500); + const results = questions.filter((q) => q.questionId === questionId); + return results.length === 0 ? null : results[0]; +};