Merge branch 'react-version' of https://github.com/MarcEricMartel/420-5DW-HY-TP into react-version
This commit is contained in:
		@@ -11,6 +11,7 @@ import Login from "../pages/Login";
 | 
			
		||||
import Logout from "../pages/Logout";
 | 
			
		||||
import Register from "../pages/Register";
 | 
			
		||||
import Formulaire from "../pages/Formulaire";
 | 
			
		||||
import MyInvoices from "../pages/MyInvoices";
 | 
			
		||||
import { useState, useEffect } from "react";
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import { useCookies } from 'react-cookie';
 | 
			
		||||
@@ -47,6 +48,7 @@ const App = () => {
 | 
			
		||||
            <Route path="logout" element={<Logout/>}/>
 | 
			
		||||
            <Route path="register" element={<Register/>}/>
 | 
			
		||||
            <Route path="formulaire" element={<Formulaire/>}/>
 | 
			
		||||
            <Route path="myinvoices" element={<MyInvoices/>}/>
 | 
			
		||||
          </Route>
 | 
			
		||||
        </Routes>
 | 
			
		||||
      </BrowserRouter>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
const InvoiceItem = (invoice) => {
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
        <>
 | 
			
		||||
            <div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </>
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default InvoiceItem;
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
import InvoiceItem from "./InvoiceItem";
 | 
			
		||||
 | 
			
		||||
const InvoiceList = ({ invoices }) => {
 | 
			
		||||
    return (
 | 
			
		||||
        <>
 | 
			
		||||
            {invoices.map((invoice) => {
 | 
			
		||||
                <InvoiceItem
 | 
			
		||||
                    invoice={invoice}
 | 
			
		||||
                />
 | 
			
		||||
            })}
 | 
			
		||||
        </>
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default InvoiceList;
 | 
			
		||||
							
								
								
									
										35
									
								
								GrossesMitaines/grosses-mitaines-ui/src/pages/MyInvoices.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								GrossesMitaines/grosses-mitaines-ui/src/pages/MyInvoices.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
import { useEffect } from "react";
 | 
			
		||||
import { useState } from "react";
 | 
			
		||||
import InvoiceList from "../components/InvoiceList";
 | 
			
		||||
 | 
			
		||||
const MyInvoices = () => {
 | 
			
		||||
 | 
			
		||||
    const [invoices, setInvoices] = useState([]);
 | 
			
		||||
 | 
			
		||||
    useEffect(() => {
 | 
			
		||||
        fetch(`https://localhost:7292/api/Invoice`, {
 | 
			
		||||
            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 MyInvoices
 | 
			
		||||
@@ -255,6 +255,7 @@ a {
 | 
			
		||||
    margin-left: auto;
 | 
			
		||||
    height: 50%;
 | 
			
		||||
    width: auto;
 | 
			
		||||
    max-width: 95%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.item-info {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user