soundbirder/public/javascripts/quizz.js

32 lines
713 B
JavaScript

import client from './api-client.js';
let Quizz = {
questions: [],
answers: [],
propositions: [],
region: 'FR', // TODO: update
questionPointer: 0,
init: function() {
let { questions, answers, propositions } = client.getQuizz(region);
this.questions = questions;
this.answers = answers;
this.propositions = propositions;
this.questionPointer = 0;
},
nextQuestion: function() {
this.questionPointer += 1;
this.render();
},
previousQuestion: function() {
if (this.questionPointer >= 1) {
this.questionPointer -= 1;
}
this.render()
},
render: function() {
}
}