Initial frontend draft
This commit is contained in:
parent
1606d1faf0
commit
b6293beeec
21 changed files with 4105 additions and 150 deletions
31
frontend/app/routes/LibraryItems.tsx
Normal file
31
frontend/app/routes/LibraryItems.tsx
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router";
|
||||
import ItemCard from "~/Components/Items/ItemCard";
|
||||
import { FetchItems } from "~/Lib/Item";
|
||||
import type Item from "~/Models/Item";
|
||||
|
||||
|
||||
const LibraryItems = () => {
|
||||
const params = useParams();
|
||||
const [items, setItems] = useState<Array<Item>>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const librayId = params["libraryId"];
|
||||
|
||||
FetchItems(librayId!).then(response => {
|
||||
setItems(response);
|
||||
});
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
{items.length > 0 && items.map(item => {
|
||||
return (
|
||||
<ItemCard key={item.id} item={item} />
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LibraryItems;
|
||||
Loading…
Add table
Add a link
Reference in a new issue