({theme})
| 8 | |
| 9 | // Getting request |
| 10 | const Home = ({theme}) => { |
| 11 | const { data: libraries, isLoading, isError,} = useQuery(["libraries"], () => { |
| 12 | return fetch("http://127.0.0.1:8000/detail").then((t) => t.json()); |
| 13 | }); |
| 14 | |
| 15 | if (isLoading) return <div className="Loading" ><ReactLoading /></div>; |
| 16 | |
| 17 | if (isError) return <h1>Error with request</h1> |
| 18 | |
| 19 | return ( |
| 20 | <div className="Home_container"> |
| 21 | <div> <Navigation /> </div> |
| 22 | <div className="Home_div"> |
| 23 | <h1>Local Library Home</h1> |
| 24 | <p> |
| 25 | Welcome to LocalLibrary, a website developed by{" "} |
| 26 | <em>Gaurav Joshi </em>! |
| 27 | </p> |
| 28 | <h2>Dynamic content</h2> |
| 29 | <p>The library has the following record counts:</p> |
| 30 | <ul> |
| 31 | <li><strong>Books: <p> {libraries.num_books} </p></strong></li> |
| 32 | <li><strong>Copies: <p> {libraries.num_instances}</p></strong></li> |
| 33 | <li><strong>Copies available: <p> {libraries.num_instances_available}</p></strong></li> |
| 34 | <li><strong>Authors: <p> {libraries.num_authors}</p></strong></li> |
| 35 | </ul> |
| 36 | </div> |
| 37 | </div> |
| 38 | ); |
| 39 | }; |
| 40 | |
| 41 | export default Home; |
nothing calls this directly
no outgoing calls
no test coverage detected