creer jeu.js

front
Gwenael PLANCHON 1 year ago
parent 02a2c91b3a
commit f2e6e89201

@ -0,0 +1,43 @@
import { REST_API } from "@/assets/const"
import { DataObject, PagedDataObject } from "./dataObject"
export class ListeJeux extends DataObject{
constructor(parsedJSON){
super(parsedJSON)
}
static async get(){
const response = await fetch(`${REST_API}/jeux`)
return new this(await response.json())
}
}
/* JSON de reference (get ListeJeux)
[ {
"id" : 1,
"nom" : "Qui-est-ce ?",
"nbrParties" : 0,
"links" : [ {
"rel" : "self",
"href" : "http://sae-java.alix-jdlm.fr/api/v1/jeux/1"
} ]
}, {
"id" : 2,
"nom" : "Science Quizz",
"nbrParties" : 0,
"links" : [ {
"rel" : "self",
"href" : "http://sae-java.alix-jdlm.fr/api/v1/jeux/2"
} ]
}, {
"id" : 3,
"nom" : "Pendu",
"nbrParties" : 0,
"links" : [ {
"rel" : "self",
"href" : "http://sae-java.alix-jdlm.fr/api/v1/jeux/3"
} ]
} ]
*/
Loading…
Cancel
Save