Skip to content
Snippets Groups Projects
Commit ede7fea6 authored by Théophile HUSS's avatar Théophile HUSS
Browse files

feat: Add routes for quiz details in community

parent 5fa39b5b
Branches
1 merge request!48Feature/47 route api community
Pipeline #303427 passed with stages
in 54 seconds
......@@ -33,17 +33,17 @@ export class QuizDetailComponent implements OnInit, OnChanges {
loadQuizData() {
this.communityService.getQuizInformations(this.codeQuiz).subscribe({
next: (data: any) => {
this.title = data.body.title;
this.description = data.body.description;
this.nbQuestions = data.body.nbQuestions;
this.difficulty = data.body.difficulty;
this.nbPlayed = data.body.nbPlayed;
this.creator = data.body.creator;
this.title = data.name;
this.description = data.description;
this.nbQuestions = data.questions.length;
this.difficulty = data.difficulty.name;
this.nbPlayed = 12548;
this.creator = data.authorId ?? 'Anonymous';
},
});
this.showDetails = true;
}
playQuiz() {
this.router.navigate(['/play-quiz'], { queryParams: { code_quiz: this.codeQuiz } });
this.router.navigate(['/play-quiz'], { queryParams: { idQuiz: this.codeQuiz } });
}
}
......@@ -12,17 +12,6 @@ export class CommunityService {
return this.http.get(`${this.apiUrl}/quiz/all`, { params: { skip: skip, take: take, filter: filter } });
}
getQuizInformations(codeQuiz: string) {
//return this.http.get(`${this.apiUrl}/quiz/${codeQuiz}/short`);
return of({
body: {
codeQuiz: 'AMSOE',
title: 'Titre du quiz',
description: 'Ceci est un quiz avec une description',
nbQuestions: 20,
nbPlayed: 18293,
difficulty: 'hard',
creator: 'vexorit',
},
});
return this.http.post(`${this.apiUrl}/quiz/remaining`, { id: codeQuiz });
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment