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 (