les filtres fonctionnent mais le ui est laid.
This commit is contained in:
@@ -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 (
|
||||
<div className="morceaux">
|
||||
<div className="morceaux-options-container">
|
||||
<div className='filters-container'>
|
||||
<Filters onChange={handleFilters}/>
|
||||
<Filters onChange={handleFilters} />
|
||||
</div>
|
||||
<div className="sorting-container">
|
||||
<Sorting onChange={handleOrder} />
|
||||
|
||||
Reference in New Issue
Block a user