bing bong
This commit is contained in:
@@ -3,15 +3,16 @@ import { useEffect } from "react";
|
||||
import ItemList from "../components/ItemList";
|
||||
import { useState } from 'react';
|
||||
import Sorting from "../components/Sorting"
|
||||
import Filters from '../components/Filters';
|
||||
|
||||
const Morceaux = (startingProducts) => {
|
||||
|
||||
const [products, setProducts] = useState([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [order, setOrder] = useState("");
|
||||
const [filterPrice, setFilterPrice] = useState("");
|
||||
const [filterState, setFilterState] = useState("");
|
||||
|
||||
var order = "";
|
||||
var filterPrice = "";
|
||||
var filterState = "";
|
||||
|
||||
useEffect(() => {
|
||||
document.title = 'Morceaux';
|
||||
@@ -48,8 +49,8 @@ const Morceaux = (startingProducts) => {
|
||||
|
||||
const handleOrder = async (sortBy) => {
|
||||
|
||||
order = sortBy;
|
||||
var url = `https://localhost:7292/api/Inventory?order=${order}&filterPrice=${filterPrice}&filterState=${filterState}`;
|
||||
setOrder(sortBy);
|
||||
var url = `https://localhost:7292/api/Inventory?order=${sortBy}&filterPrice=${filterPrice}&filterState=${filterState}`;
|
||||
setIsLoading(true);
|
||||
const response = await fetch(url);
|
||||
const json = await response.json();
|
||||
@@ -57,17 +58,20 @@ const Morceaux = (startingProducts) => {
|
||||
setProducts([...json]);
|
||||
setIsLoading(false);
|
||||
}
|
||||
const handleFilterPrice = async () => {
|
||||
|
||||
}
|
||||
const handleFilterState = async () => {
|
||||
const handleFilters = async () => {
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="morceaux">
|
||||
<div className="sorting-container">
|
||||
<Sorting onChange={handleOrder} />
|
||||
<div >
|
||||
{/* className="morceaux-options-container" */}
|
||||
{/* <div className='filters-container'>
|
||||
<Filters onChange={handleFilters}/>
|
||||
</div> */}
|
||||
<div className="sorting-container">
|
||||
<Sorting onChange={handleOrder} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="morceaux-container">
|
||||
<ItemList items={products} />
|
||||
|
||||
Reference in New Issue
Block a user