refaire fonctionner l'animation avec pointsGagne

front
Gwenael PLANCHON 1 year ago
parent b715d8de1f
commit e97d61f8e1

@ -32,6 +32,7 @@ export default {
},
//variables pour les scores
score:{
score:0,
pointsGagne:0,
},
pointsAnimation:0,
@ -81,7 +82,7 @@ export default {
},
obtenirScores(){
this.resetEtats() //cacher l'etat precedent
this.kahootAPI.obtenirScore().then(response=>{
this.kahootAPI.obtenirScore(this.score.score).then(response=>{
this.tempsLimite=response.tempsLimite
this.score=response
//afficher cet etat

@ -15,12 +15,12 @@ export class Kahoot{
const response=await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}/question`)
return new KahootQuestion(await response.json())
}
async obtenirScore(){
async obtenirScore(ancienScore=0){
const user = await Utilisateur.utilisateurConnecteOuCreerInvite()
const response=await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}/status`)
let json=await response.json()
json.score=json.scores.find(score=>score.joueur.id==user.id).score
json.pointsGagne=0
json.pointsGagne=json.score-ancienScore
return new KahootScore(json)
}
async repondreQuestion(id){

Loading…
Cancel
Save