From b0e2f0e25b8aa8b3f2ed11f2cdf3d9d47c2697f1 Mon Sep 17 00:00:00 2001 From: djmil Date: Mon, 21 Aug 2023 18:05:19 +0200 Subject: [PATCH] ReactJS: user managment --- webapp/src/App.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/webapp/src/App.js b/webapp/src/App.js index 71598e2..1915a39 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -3,14 +3,15 @@ import React, { useState, useEffect } from 'react'; function App() { - const [joke, setJoke] = useState(null); + const [activeGames, setActiveGames] = useState(null); useEffect(() => { - fetch('/api/badjokes') + fetch('/api/activegames') .then((response) => response.json()) - .then((data) => { - console.log(data.joke); - setJoke(data.joke); + .then((games) => { + console.log(games.ActiveGames.length); + console.log("games: " +games.ActiveGames); + setActiveGames(games.ActiveGames); }) .catch((err) => { console.log(err.message); @@ -21,7 +22,7 @@ function App() {

- Here is your joke: {joke ? {joke} : Loading...} + Here is list of your active games: {activeGames ? {activeGames} : Loading...}