diff options
Diffstat (limited to 'src/App.js')
-rw-r--r-- | src/App.js | 31 |
1 files changed, 22 insertions, 9 deletions
@@ -1,18 +1,31 @@ +import useSWR from "swr"; import logo from "./logo.svg"; import "./App.css"; +const url = "https://rcpoller.galenguyer.com/api/v0/history"; + function App() { + const { data: data, error: error } = useSWR(url); + + if (error) + return ( + <div className="App"> + <h1>RIT Covid Dashboard</h1> + <h2>An error occurred</h2> + </div> + ); + if (!data) + return ( + <div className="App"> + <h1>RIT Covid Dashboard</h1> + <h2>Loading latest data...</h2> + </div> + ); + return ( <div className="App"> - <header className="App-header"> - <img src={logo} className="App-logo" alt="logo" /> - <p> - Edit <code>src/App.js</code> and save to reload. - </p> - <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer"> - Learn React - </a> - </header> + <h1>RIT Covid Dashboard</h1> + <h2>Data Loaded</h2> </div> ); } |