product-card
This commit is contained in:
4
api/endpoints/getProductsList.ts
Normal file
4
api/endpoints/getProductsList.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import api from '~/api/instance'
|
||||
|
||||
export const getProductsList = async () =>
|
||||
await api.wc.v3ProductsList()
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './getProductsDetail'
|
||||
export * from './getProductsList'
|
||||
export * from './getProductsVariationsList'
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './useGetProductsDetail'
|
||||
export * from './useGetProductsList'
|
||||
export * from './useGetProductsVariationsList'
|
||||
|
||||
10
api/queries/useGetProductsList.ts
Normal file
10
api/queries/useGetProductsList.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { getProductsList } from '~/api/endpoints/getProductsList'
|
||||
|
||||
export const useGetProductsList = () => {
|
||||
return useQuery({
|
||||
queryKey: ['get-products-list'],
|
||||
queryFn: () => getProductsList(),
|
||||
staleTime: Infinity,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user