|
|
@ -10,16 +10,6 @@ export class Kahoot{
|
|
|
|
const response=await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}/status`)
|
|
|
|
const response=await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}/status`)
|
|
|
|
return new KahootSalleAttente(await response.json())
|
|
|
|
return new KahootSalleAttente(await response.json())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async creerPartie(){
|
|
|
|
|
|
|
|
const user = await Utilisateur.utilisateurConnecteOuCreerInvite()
|
|
|
|
|
|
|
|
const response = await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}`,{
|
|
|
|
|
|
|
|
method:"POST",
|
|
|
|
|
|
|
|
headers:{"Content-Type":"application/json"},
|
|
|
|
|
|
|
|
//{"idJoueur": 0, "thematiques": [0,1,2,3], "idDifficulte": 0}
|
|
|
|
|
|
|
|
body:{"idJoueur":user.id, "thematiques":this.thematiques, "idDifficulte":this.idDifficulte}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return new KahootDetailsPartie(await response.json())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -54,10 +44,20 @@ out:
|
|
|
|
"difficulte": {"id":0, "libelle": 0}
|
|
|
|
"difficulte": {"id":0, "libelle": 0}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export class KahootDetailsPartie extends DataObject{
|
|
|
|
export class KahootPartie extends DataObject{
|
|
|
|
constructor(parsedJSON){
|
|
|
|
constructor(parsedJSON){
|
|
|
|
super(parsedJSON)
|
|
|
|
super(parsedJSON)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async creerPartie(){
|
|
|
|
|
|
|
|
const user = await Utilisateur.utilisateurConnecteOuCreerInvite()
|
|
|
|
|
|
|
|
const response = await fetch(`${REST_API}/partie/kahoot`,{
|
|
|
|
|
|
|
|
method:"POST",
|
|
|
|
|
|
|
|
headers:{"Content-Type":"application/json"},
|
|
|
|
|
|
|
|
//{"idJoueur": 0, "thematiques": [0,1,2,3], "idDifficulte": 0}
|
|
|
|
|
|
|
|
body:JSON.stringify({"idJoueur":user.id, "thematiques":this.thematiques, "idDifficulte":this.idDifficulte})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return new this.constructor(await response.json())
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* JSON de reference (question)
|
|
|
|
/* JSON de reference (question)
|
|
|
|