From deee825a48295a2262139ba9ce0c6439f26c373e Mon Sep 17 00:00:00 2001 From: Victor Turgeon <76506447+Medenos@users.noreply.github.com> Date: Sat, 29 Oct 2022 08:24:43 -0700 Subject: [PATCH] les filtres fonctionnent mais le ui est laid. --- .../grosses-mitaines-ui/src/components/Filters.js | 12 ++++++++---- .../grosses-mitaines-ui/src/pages/Morceaux.js | 13 +++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/Filters.js b/GrossesMitaines/grosses-mitaines-ui/src/components/Filters.js index e1d0c38..e6765a6 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/Filters.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/Filters.js @@ -1,16 +1,17 @@ import { Form } from "react-bootstrap"; import { useState } from "react"; +import {Button} from "react-bootstrap"; const Filters = ({ onChange }) => { const [priceFilter, setPriceFilter] = useState(""); const [stateFilter, setStateFilter] = useState(""); - const handlePriceChange = (value) =>{ + const handlePriceChange = (value) => { setPriceFilter(value); } - const handleStateChange = (value) =>{ + const handleStateChange = (value) => { setStateFilter(value); } @@ -61,7 +62,7 @@ const Filters = ({ onChange }) => {
- +
handleStateChange(e.target.value)}> { value="" /> {
+
) } diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js index 807ec5d..586c4bc 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Morceaux.js @@ -58,15 +58,24 @@ const Morceaux = (startingProducts) => { setProducts([...json]); setIsLoading(false); } - const handleFilters = async () => { + const handleFilters = async (price, state) => { + setFilterPrice(price); + setFilterState(state); + var url = `https://localhost:7292/api/Inventory?order=${order}&filterPrice=${price}&filterState=${state}`; + setIsLoading(true); + const response = await fetch(url); + const json = await response.json(); + if (json.length > 0) + setProducts([...json]); + setIsLoading(false); } return (
- +