MCPcopy Create free account
hub / github.com/codemistic/Web-Development / Home

Function Home

locallibrary/frontend/src/pages/Home.jsx:10–39  ·  view source on GitHub ↗
({theme})

Source from the content-addressed store, hash-verified

8
9// Getting request
10const 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: &nbsp;<p> {libraries.num_books} </p></strong></li>
32 <li><strong>Copies: &nbsp;<p> {libraries.num_instances}</p></strong></li>
33 <li><strong>Copies available: &nbsp;<p> {libraries.num_instances_available}</p></strong></li>
34 <li><strong>Authors: &nbsp;<p> {libraries.num_authors}</p></strong></li>
35 </ul>
36 </div>
37 </div>
38 );
39};
40
41export default Home;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected