basic commandes et mesCommandes

This commit is contained in:
Victor Turgeon
2022-11-08 00:42:15 -05:00
parent 28fff14d96
commit a5a1be67a3
4 changed files with 180 additions and 31 deletions

View File

@@ -0,0 +1,35 @@
import { useEffect } from "react";
import { useState } from "react";
import InvoiceList from "../components/InvoiceList";
const Invoices = () => {
const [invoices, setInvoices] = useState([]);
useEffect(() => {
fetch(`https://localhost:7292/api/Invoice?all=true`, {
method: 'GET',
mode: 'cors',
credentials: 'include'
}).then(async (response) => {
if (response.ok) {
var json = await response.json();
console.log(json);
setInvoices(json);
}
else{
console.log("Erreur lors de la requête des invoices");
}
});
}, []);
return (
<>
<InvoiceList
invoices={invoices}
/>
</>
);
}
export default Invoices