diff --git a/pages/index.tsx b/pages/index.tsx index ffcb1fe..2fd724e 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -8,12 +8,26 @@ import { IndexGallery } from "../components/IndexGallery/IndexGallery"; const PageIndex = () => { const [splash, setSplash] = useState(""); + const [memberCount, setMemberCount] = useState(""); function randomizeSplash(): void { setSplash(splashes[Math.floor(Math.random() * splashes.length)].body); } useEffect(() => { randomizeSplash(); }, []); + useEffect(() => { + fetch("https://gractwo.pl/api/members") + .then((res) => { + return res.text(); + }) + .then((data) => { + console.log(data); + setMemberCount(data); + }) + .catch((err) => { + console.log(err); + }); + }); const welcometext: string = "Witamy na witrynie internetowej Gractwa."; // Mamy nadzieję że odnajdziesz czego szukasz, zbłąkana duszo."; return ( <> @@ -34,7 +48,7 @@ const PageIndex = () => {
-

~200

+

{memberCount || "∞"}

członków na discordzie