Merge pull request #10 from gractwo/heisenberg
switch index splashes from json to api fetch
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"body": "ona jest narysowana debilu",
|
||||
"author": "jamesen"
|
||||
},
|
||||
{
|
||||
"body": "idą jak surykatki na śmierć puszczone",
|
||||
"author": "mollin"
|
||||
},
|
||||
{
|
||||
"body": "jak spotkam stacha będziemy się napierdalać",
|
||||
"author": "KuOlek"
|
||||
},
|
||||
{
|
||||
"body": "to nie kwestia fetyszu, to kwestia prawa izraela",
|
||||
"author": "stachowiak"
|
||||
},
|
||||
{
|
||||
"body": "czemu ten szkielet ma oczy i czilluje",
|
||||
"author": "stachowiak"
|
||||
},
|
||||
{
|
||||
"body": "decymalizacja człowieka",
|
||||
"author": "elephant / suoń"
|
||||
},
|
||||
{
|
||||
"body": "pizdeczka... z całym szacunkiem",
|
||||
"author": "bavil gravlax"
|
||||
},
|
||||
{
|
||||
"body": "mam dwunastometrowego kija w dupie",
|
||||
"author": "stachowiak"
|
||||
},
|
||||
{
|
||||
"body": "pamięć wody o jabłku",
|
||||
"author": "maciuś"
|
||||
},
|
||||
{
|
||||
"body": "właśnie piszę biblię",
|
||||
"author": "elephant / suoń"
|
||||
}
|
||||
]
|
||||
@@ -2,7 +2,6 @@ import styles from "../styles/Index.module.scss";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SEO } from "../components/SEO";
|
||||
import { Icon } from "../components/Icon";
|
||||
import splashes from "../data/splashes.json";
|
||||
import Link from "next/link";
|
||||
import { IndexGallery } from "../components/IndexGallery/IndexGallery";
|
||||
|
||||
@@ -10,12 +9,20 @@ const PageIndex = () => {
|
||||
const [splash, setSplash] = useState("");
|
||||
const [memberCount, setMemberCount] = useState("");
|
||||
function randomizeSplash(): void {
|
||||
setSplash(splashes[Math.floor(Math.random() * splashes.length)].body);
|
||||
fetch("https://gractwo.pl/api/v1/splash")
|
||||
.then((res) => {
|
||||
return res.json();
|
||||
})
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
setSplash(data.Splash);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
useEffect(() => {
|
||||
randomizeSplash();
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
fetch("https://gractwo.pl/api/members")
|
||||
.then((res) => {
|
||||
return res.text();
|
||||
@@ -26,7 +33,7 @@ const PageIndex = () => {
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
}, []);
|
||||
const welcometext: string = "Witamy na witrynie internetowej Gractwa."; // Mamy nadzieję że odnajdziesz czego szukasz, zbłąkana duszo.";
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user