docs: fixed a typo in variable name from currnetProductPage to currentProductPage (#12719)
Corrected a typo in the variable name `currnetProductPage`, which was changed to `currentProductPage` for improved readability and consistency.
This commit is contained in:
1 parent
0502e8bf78
commit
13092a6caa
1 file changed
+4
-4
@@ -1295,7 +1295,7 @@ Next, you need to retrieve the list of products in Medusa to show them in a sele
|
|||||||
export const createBundledProductComponentHighlights2 = [
|
export const createBundledProductComponentHighlights2 = [
|
||||||
["1", "products", "The products to show in the selector."],
|
["1", "products", "The products to show in the selector."],
|
||||||
["2", "productsLimit", "The maximum number of products to retrieve."],
|
["2", "productsLimit", "The maximum number of products to retrieve."],
|
||||||
["3", "currnetProductPage", "The current page of products retrieved from the server."],
|
["3", "currentProductPage", "The current page of products retrieved from the server."],
|
||||||
["4", "productsCount", "The total number of products."],
|
["4", "productsCount", "The total number of products."],
|
||||||
["5", "hasNextPage", "Whether there are more products to load."],
|
["5", "hasNextPage", "Whether there are more products to load."],
|
||||||
["9", "useQuery", "Retrieve the products from the API route."],
|
["9", "useQuery", "Retrieve the products from the API route."],
|
||||||
@@ -1305,7 +1305,7 @@ export const createBundledProductComponentHighlights2 = [
|
|||||||
```tsx title="src/admin/components/create-bundled-product.tsx" highlights={createBundledProductComponentHighlights2}
|
```tsx title="src/admin/components/create-bundled-product.tsx" highlights={createBundledProductComponentHighlights2}
|
||||||
const [products, setProducts] = useState<HttpTypes.AdminProduct[]>([])
|
const [products, setProducts] = useState<HttpTypes.AdminProduct[]>([])
|
||||||
const productsLimit = 15
|
const productsLimit = 15
|
||||||
const [currnetProductPage, setCurrentProductPage] = useState(0)
|
const [currentProductPage, setCurrentProductPage] = useState(0)
|
||||||
const [productsCount, setProductsCount] = useState(0)
|
const [productsCount, setProductsCount] = useState(0)
|
||||||
const hasNextPage = useMemo(() => {
|
const hasNextPage = useMemo(() => {
|
||||||
return productsCount ? productsCount > productsLimit : true
|
return productsCount ? productsCount > productsLimit : true
|
||||||
@@ -1317,7 +1317,7 @@ useQuery({
|
|||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { products, count } = await sdk.admin.product.list({
|
const { products, count } = await sdk.admin.product.list({
|
||||||
limit: productsLimit,
|
limit: productsLimit,
|
||||||
offset: currnetProductPage * productsLimit,
|
offset: currentProductPage * productsLimit,
|
||||||
})
|
})
|
||||||
setProductsCount(count)
|
setProductsCount(count)
|
||||||
setProducts((prev) => [...prev, ...products])
|
setProducts((prev) => [...prev, ...products])
|
||||||
@@ -1330,7 +1330,7 @@ const fetchMoreProducts = () => {
|
|||||||
if (!hasNextPage) {
|
if (!hasNextPage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setCurrentProductPage(currnetProductPage + 1)
|
setCurrentProductPage(currentProductPage + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add creation logic
|
// TODO add creation logic
|
||||||
|
|||||||
Reference in new issue
Block a user