refactor: handle api models identifiers

This commit is contained in:
2022-10-10 10:29:25 +02:00
parent baccbf8d56
commit 09ff7433ed
9 changed files with 32 additions and 27 deletions

View File

@@ -8,10 +8,8 @@
<section v-if="currentResult" class="last-quiz">
<div class="last-quiz-header">
<span class="date"> {{ currentResult.createdDate | formatDate }}</span>
<!-- FIXME remove this dirty trick -->
<nuxt-link
class="link"
:to="{ path: '/details', query: { quiz: currentResult._links.self.href.replace('http://localhost:8080/quizzes/','') }}">
class="link" :to="{ path: '/details', query: { quiz: currentResult.id }}">
+ Voir le détail
</nuxt-link>
</div>
@@ -55,10 +53,7 @@ export default class History extends Vue {
this.quizzes = response.data._embedded.quizzes;
});
for (const quiz of this.quizzes) {
// FIXME ugly : replace when scores will be handled as a REST resource
console.info(quiz);
const id = Number.parseInt(quiz._links.self.href.replace("http://localhost:8080/quizzes/", ""));
await this.quizRepository.findScores(id)
await this.quizRepository.findScores(quiz.id)
.then((value: AxiosResponse<Score[]>) => {
quiz.scores = value.data;
});