Skip to content
Merged

Fixes #229

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions frontend/lib/api/quizApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@ export interface PuzzleResponseDto {
id: string;
question: string;
options: string[];
correctAnswer: string; // ✅ Add this
difficulty: string;
category: { // ✅ Add full category object
id: string;
name: string;
description: string;
icon: string | null;
isActive: boolean;
createdAt: string;
};
categoryId: string;
points: number;
timeLimit: number;
isCompleted: boolean;
explanation: string;
createdAt: string;
updatedAt: string;
isCompleted?: boolean;
}

export interface DailyQuestResponseDto {
Expand Down Expand Up @@ -73,7 +85,7 @@ export async function fetchDailyQuest(): Promise<DailyQuestResponseDto> {
"Content-Type": "application/json",
...getAuthHeaders(),
};
const response = await fetch(`${API_BASE_URL}/puzzles/daily-quest`, {
const response = await fetch("http://localhost:3000/puzzles/daily-quest", {
method: "GET",
headers,
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/features/quiz/quizSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ function mapPuzzleToQuestion(puzzle: PuzzleResponseDto): Question {
id: puzzle.id,
text: puzzle.question,
options: puzzle.options,
correctAnswer: puzzle.correctAnswer,
points: puzzle.points,
categoryId: puzzle.categoryId,
difficulty: puzzle.difficulty,
timeLimit: puzzle.timeLimit,
isCompleted: puzzle.isCompleted,
// correctAnswer will be set after submission
};
}

Expand Down