From 786c9e13f022ee75d521c17b34c59e17803637ea Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 2 Jul 2025 17:07:57 +0200 Subject: [PATCH] Rename getProducts to getProductsAsync for clarity Updated the `getProducts` function in `product-service.ts` to `getProductsAsync` to reflect its asynchronous nature. Adjusted the import in `products-view.tsx` accordingly and modified the `useEffect` hook in `ProductsView` to utilize the new function, ensuring proper handling of asynchronous requests. --- src/client/dd-hub-react/src/api/product-service.ts | 2 +- .../dd-hub-react/src/sections/product/view/products-view.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/dd-hub-react/src/api/product-service.ts b/src/client/dd-hub-react/src/api/product-service.ts index ed57109..8bc2934 100644 --- a/src/client/dd-hub-react/src/api/product-service.ts +++ b/src/client/dd-hub-react/src/api/product-service.ts @@ -13,7 +13,7 @@ export type Product = { * send a request to the server to get the products * @returns Array of products */ -export function getProducts(): Promise { +export function getProductsAsync(): Promise { //TODO: Implement the API call using fetch or axios return Promise.resolve([ { diff --git a/src/client/dd-hub-react/src/sections/product/view/products-view.tsx b/src/client/dd-hub-react/src/sections/product/view/products-view.tsx index 127b9a8..aaa6f4a 100644 --- a/src/client/dd-hub-react/src/sections/product/view/products-view.tsx +++ b/src/client/dd-hub-react/src/sections/product/view/products-view.tsx @@ -7,7 +7,7 @@ import Typography from '@mui/material/Typography'; import { _products } from 'src/_mock'; import { DashboardContent } from 'src/layouts/dashboard'; -import { getProducts, Product } from 'src/api/product-service'; +import { getProductsAsync, Product } from 'src/api/product-service'; import { ProductSort } from '../product-sort'; import { ProductItem } from '../product-item'; @@ -88,7 +88,7 @@ export function ProductsView() { ); useEffect(() => { - getProducts().then((res) => { + getProductsAsync().then((res) => { setProducts(res); }); }, []);