Replace apiRequest with clientFetch across app
Refactored all API calls to use the new clientFetch utility instead of apiRequest in dashboard pages, modal components, and profit analytics service. This improves consistency and aligns with updated API handling patterns.
This commit is contained in:
@@ -6,7 +6,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||
import { Search, Package } from "lucide-react";
|
||||
import { apiRequest } from "@/lib/api";
|
||||
import { clientFetch } from "@/lib/api";
|
||||
|
||||
interface Product {
|
||||
_id: string;
|
||||
@@ -30,7 +30,7 @@ export default function ProductSelector({ selectedProducts, onSelectionChange }:
|
||||
useEffect(() => {
|
||||
const fetchProducts = async () => {
|
||||
try {
|
||||
const fetchedProducts = await apiRequest('/products/for-selection', 'GET');
|
||||
const fetchedProducts = await clientFetch('/products/for-selection');
|
||||
setProducts(fetchedProducts);
|
||||
} catch (error) {
|
||||
console.error('Error fetching products:', error);
|
||||
|
||||
Reference in New Issue
Block a user