From f2e6e892016ea35180139f1b3d4d0a86d4a6e9b3 Mon Sep 17 00:00:00 2001 From: "gwenael.planchon" Date: Thu, 28 Mar 2024 11:35:38 +0100 Subject: [PATCH] creer jeu.js --- science-quest/src/data/jeu.js | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 science-quest/src/data/jeu.js diff --git a/science-quest/src/data/jeu.js b/science-quest/src/data/jeu.js new file mode 100644 index 0000000..00064d3 --- /dev/null +++ b/science-quest/src/data/jeu.js @@ -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" + } ] +} ] +*/ +