loading cat in inventory
This commit is contained in:
parent
16e0321db0
commit
e92dfc0772
@ -7,8 +7,10 @@ const Inventaire = () => {
|
|||||||
|
|
||||||
const [morceaux, setMorceaux] = useState([]);
|
const [morceaux, setMorceaux] = useState([]);
|
||||||
const [isFormvisible, setFormVisibility] = useState(false);
|
const [isFormvisible, setFormVisibility] = useState(false);
|
||||||
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
document.title = 'Inventaire';
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const response = await fetch(`https://localhost:7292/api/Inventory?all=true`);
|
const response = await fetch(`https://localhost:7292/api/Inventory?all=true`);
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
@ -16,7 +18,7 @@ const Inventaire = () => {
|
|||||||
setMorceaux([...json]);
|
setMorceaux([...json]);
|
||||||
}
|
}
|
||||||
fetchData();
|
fetchData();
|
||||||
document.title = 'Inventaire';
|
setIsLoading(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleAddItem = async (morceau) => {
|
const handleAddItem = async (morceau) => {
|
||||||
@ -101,6 +103,7 @@ const Inventaire = () => {
|
|||||||
|
|
||||||
</header>
|
</header>
|
||||||
{isFormvisible && <Ajouter onCreation={handleAddItem}></Ajouter>}
|
{isFormvisible && <Ajouter onCreation={handleAddItem}></Ajouter>}
|
||||||
|
{isLoading && <div className="cat-load" />}
|
||||||
{morceaux.length > 0 ?
|
{morceaux.length > 0 ?
|
||||||
(<SimpleItemList simpleItems={morceaux}
|
(<SimpleItemList simpleItems={morceaux}
|
||||||
onDelete={handleDeleteItem}
|
onDelete={handleDeleteItem}
|
||||||
|
Loading…
Reference in New Issue
Block a user