refactor: handle api models identifiers
This commit is contained in:
@@ -9,15 +9,15 @@ import {QuizRate, Response} from "~/repositories/models/quiz.model";
|
||||
})
|
||||
export default class Quiz extends VuexModule {
|
||||
|
||||
responses = new Map<string, QuizRate>;
|
||||
questionsRatedPerAxe = new Map<number, { questionId: string; rated: boolean }[]>;
|
||||
responses = new Map<number, QuizRate>;
|
||||
questionsRatedPerAxe = new Map<number, { questionId: number; rated: boolean }[]>;
|
||||
|
||||
@Mutation
|
||||
initialize(questions: Map<number, Question[]>) {
|
||||
questions.forEach((questions, axeId) => this.questionsRatedPerAxe.set(axeId, questions.map(value => {
|
||||
return {
|
||||
questionId: value._links.self.href,
|
||||
rated: this.responses.has(value._links.self.href)
|
||||
questionId: value.id,
|
||||
rated: this.responses.has(value.id)
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
Reference in New Issue
Block a user