+
{loading ? (
diff --git a/src/pages/products/ProductList.jsx b/src/pages/products/ProductList.jsx
index b633d6b..8113b6f 100644
--- a/src/pages/products/ProductList.jsx
+++ b/src/pages/products/ProductList.jsx
@@ -6,6 +6,8 @@ import { useAuth } from '../../context/AuthContext';
const ProductList = () => {
const { token } = useAuth();
const [searchTerm, setSearchTerm] = useState('');
+ const [productFilter, setProductFilter] = useState('all');
+ const [sellerFilter, setSellerFilter] = useState('all');
const [products, setProducts] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
@@ -14,7 +16,15 @@ const ProductList = () => {
const fetchProducts = async () => {
try {
setLoading(true);
- const res = await fetch(`${API_BASE_URL}/products/`, {
+ let url = `${API_BASE_URL}/products/`;
+ const params = [];
+ if (productFilter !== 'all') params.push(`status=${productFilter}`);
+ if (sellerFilter !== 'all') params.push(`seller_status=${sellerFilter}`);
+ if (params.length > 0) {
+ url += `?${params.join('&')}`;
+ }
+
+ const res = await fetch(url, {
headers: {
'Authorization': `Bearer ${token}`
}
@@ -31,7 +41,7 @@ const ProductList = () => {
useEffect(() => {
fetchProducts();
- }, [token]);
+ }, [productFilter, sellerFilter, token]);
const handleStatusChange = async (prodId, action) => {
try {
@@ -78,14 +88,53 @@ const ProductList = () => {
Product Review & Management
-
-
setSearchTerm(e.target.value)}
- />
+ {/* Search and Filters row */}
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+ {/* Product Status Filter */}
+
+
Product Status:
+
+ {['all', 'pending', 'approved', 'hold', 'rejected'].map((status) => (
+
+ ))}
+
+
+
+ {/* Seller Status Filter */}
+
+
Seller Status:
+
+ {['all', 'unverified', 'pending_approval', 'approved', 'rejected', 'suspended'].map((status) => (
+
+ ))}
+
+
+
{loading ? (
diff --git a/src/pages/sellers/SellerList.jsx b/src/pages/sellers/SellerList.jsx
index 5bdd6d4..6588743 100644
--- a/src/pages/sellers/SellerList.jsx
+++ b/src/pages/sellers/SellerList.jsx
@@ -61,7 +61,7 @@ const SellerList = () => {
onChange={(e) => setSearchTerm(e.target.value)}
/>
- {['all', 'pending_approval', 'approved', 'suspended', 'banned'].map((status) => (
+ {['all', 'unverified', 'pending_approval', 'approved', 'rejected', 'suspended'].map((status) => (