diff --git a/src/OurSponsors/OurSponsors.js b/src/OurSponsors/OurSponsors.js index dc42482..3c33305 100644 --- a/src/OurSponsors/OurSponsors.js +++ b/src/OurSponsors/OurSponsors.js @@ -4,6 +4,7 @@ import currentSponsorData from "../MockDB/sponsorship.yml"; import pastSponsorData from "../MockDB/pastSponsors.yml"; import yaml from "js-yaml"; import OpenPage from "../Header/OpenPage"; +import fakeDelay from "../TestingTools/fakeDelay"; /** * @param {null} null - requires onthing @@ -30,9 +31,10 @@ const OurSponsors = () => { */ const getCurrentSponsors = async () => { try { + await fakeDelay(5000); const res = await fetch(currentSponsorData); const rawText = await res.text(); - const yamlDict = yaml.load(rawText); + const yamlDict = await yaml.load(rawText); setCurrentSponsorsDict(yamlDict); } catch (error) { //error checking @@ -51,116 +53,120 @@ const OurSponsors = () => { try { const res = await fetch(pastSponsorData); const rawText = await res.text(); - const yamlDict = yaml.load(rawText); + const yamlDict = await yaml.load(rawText); setPastSponsorsDict(yamlDict); } catch (error) { // error checking console.error("Error recieving data from server:"); } }; - // needs to change into ? : statement and have content above it - if (!currentSponsorsDict && !pastSponsorsDict) { - //awaiting for a resposne from the backend - //add loading notification to user - return

Loading...

; - } - if (currentSponsorsDict && pastSponsorsDict) { - //maps out the dictionary and displays the content - return ( -
-
- -
- - + + return ( +
+
+
- ); - } + + +
+ ); }; export default OurSponsors;