diff --git a/src/App.jsx b/src/App.jsx index 5ef8293f..6944c8a8 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -7,7 +7,7 @@ function App() { return (
- +
) diff --git a/src/sections/Advice/index.jsx b/src/sections/Advice/index.jsx index 0405f11f..4c89edd8 100644 --- a/src/sections/Advice/index.jsx +++ b/src/sections/Advice/index.jsx @@ -1,9 +1,84 @@ +import { useEffect, useState } from "react" + + function AdviceSection() { + + + const [data, setData] = useState({"slip": { "id": 0, "advice": "Dummy"}}); + const [fav, setFav] = useState(["Dummy", "strings"]); + + + useEffect(() =>{ + fetch('https://api.adviceslip.com/advice') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + console.log(data); + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + + + }, []); + + const update = () =>{ + + fetch('https://api.adviceslip.com/advice') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + console.log(data); + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + }; + + + + + return (

Advice Section

-
-
+
+

Some Advice

+ + {

{(data.slip.advice) ? data.slip.advice : "loading"}

} + + + + +
+
+

Favourite Advice Slips

+ +
) } diff --git a/src/sections/Art/index.jsx b/src/sections/Art/index.jsx index 0c74ffc2..5a1cf5d0 100644 --- a/src/sections/Art/index.jsx +++ b/src/sections/Art/index.jsx @@ -1,10 +1,103 @@ +import { useEffect, useState } from "react" + function ArtsSection() { + + + const [data, setData] = useState([]); + const [loading,setLoading] = useState(true); + + useEffect(() =>{ + fetch('https://boolean-uk-api-server.fly.dev/art') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + setLoading(false); +/* console.log(data); + console.log(loading); */ + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + +/* data.map((item, index) => ({ + url = 'https://boolean-uk-api-server.fly.dev/art' + {item.imageURL} + fetch(url) + .then(response => { + + setdata( datas => ({ + ...datas.map(item => + ...item, imageURL: + ), + + + }) + + + + }) + + }) + + + + */ + }, []); + + + + + return ( + <>

Arts Section

-
+
+ +
+ ) } export default ArtsSection + + +/*

Paris Street; Rainy Day

+

Artist: Gustave Caillebotte

+

Publication History:

+ */ \ No newline at end of file diff --git a/src/sections/Users/index.jsx b/src/sections/Users/index.jsx index 77332830..938a0fa2 100644 --- a/src/sections/Users/index.jsx +++ b/src/sections/Users/index.jsx @@ -1,8 +1,55 @@ +import { useEffect, useState } from "react" + function UsersSection() { + + + const [data, setData] = useState([]); + const [loading,setLoading] = useState(true); + + useEffect(() =>{ + fetch('https://boolean-uk-api-server.fly.dev/emazau/contact') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + setLoading(false); + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + + }, []); + + + + return (

Users Section

-
+
+ +
) }