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