refactor: handle api models identifiers
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
@@ -87,7 +87,6 @@ export default class Result extends Vue {
|
||||
}
|
||||
|
||||
getResponses(axe: Axe) {
|
||||
console.info(this.responses)
|
||||
return this.responses.filter((response: ResponseWithQuestion) => response.axeIdentifier === axe.identifier);
|
||||
}
|
||||
}
|
||||
|
@@ -130,8 +130,8 @@ export default class Login extends Vue {
|
||||
responsesFormatted.push({
|
||||
score: value.score ? value.score : 0,
|
||||
comment: value.comment,
|
||||
questionId: Number.parseInt(key.replace("http://localhost:8080/questions/", "")) // FIXME use correct url when score will be a REST ressource
|
||||
})
|
||||
questionId: key
|
||||
});
|
||||
});
|
||||
|
||||
this.saving = true;
|
||||
|
Reference in New Issue
Block a user