This commit is contained in:
12724
api/Api.ts
12724
api/Api.ts
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
import api from '~/api/instance'
|
||||
|
||||
export const getProductsDetail = async (productId: number) =>
|
||||
await api.wc.v1ProductsDetail(productId)
|
||||
await api.wc.v3ProductsDetail(productId)
|
||||
|
||||
4
api/endpoints/getProductsVariationsList.ts
Normal file
4
api/endpoints/getProductsVariationsList.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import api from '~/api/instance'
|
||||
|
||||
export const getProductsVariationsList = async (productId: number) =>
|
||||
await api.wc.v3ProductsVariationsList(productId)
|
||||
@@ -1 +1,2 @@
|
||||
export * from './getProductsDetail'
|
||||
export * from './getProductsVariationsList'
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export * from './useGetProductsDetail'
|
||||
export * from './useGetProductsVariationsList'
|
||||
|
||||
10
api/queries/useGetProductsVariationsList.ts
Normal file
10
api/queries/useGetProductsVariationsList.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { unref } from 'vue'
|
||||
import { getProductsVariationsList } from '~/api/endpoints'
|
||||
|
||||
export const useGetProductsVariationsList = (productId: MaybeRef<number>) => {
|
||||
return useQuery({
|
||||
queryKey: ['get-products-variations-list', productId],
|
||||
queryFn: () => getProductsVariationsList(unref(productId)),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user