diff --git a/components/lists/QuizList.tsx b/components/lists/QuizList.tsx index 535915fa1ca573cbc1d8c0b01d6aecf9b44f3f87..dfad0f6d892395de3a1f4dbfc89f83d0c91a90dd 100644 --- a/components/lists/QuizList.tsx +++ b/components/lists/QuizList.tsx @@ -41,11 +41,14 @@ interface Props { onQuizPressed:(quiz: Quiz) => void; } export default function QuizList({ quizList, isLoadingData, nextPage, onQuizPressed }: Props) { + if (quizList) { + console.log(quizList[0]); + } const renderQuizItem = ({ item }: { item: Quiz }) => ( <TouchableOpacity style={styles.quizItem} onPress={() => onQuizPressed(item)}> - <Text style={styles.quizTitle}>{item.id}</Text> + <Text style={styles.quizTitle}>{item.name}</Text> <Text style={styles.quizDetails}> - {item.questionCount} QUESTIONS | {item.category ? item.category.name.toUpperCase() : ""} + {item.questionCount} QUESTIONS | {item.difficulty.name} | {item.author.username} </Text> </TouchableOpacity> ); diff --git a/models/Quiz.ts b/models/Quiz.ts index c717243639039f48eba212f465762911876f85e1..83a628419c4ef3a5d1557ef0f42d4cd17c2d40dd 100644 --- a/models/Quiz.ts +++ b/models/Quiz.ts @@ -13,6 +13,12 @@ export interface Category { name: string; } +interface Author { + id: number; + username: string; +} + + export interface Quiz { id: string; name: string; @@ -22,6 +28,7 @@ export interface Quiz { questionCount: number; categoryId: number; difficultyId: number; + author: Author, authorId: number, category?: Category, difficulty: Difficulty,