This commit is contained in:
11
api/queries/wp/useGetProductsDetail.ts
Normal file
11
api/queries/wp/useGetProductsDetail.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useQuery } from '@tanstack/vue-query'
|
||||
import { unref } from 'vue'
|
||||
import { getProductsDetail } from '~/api/endpoints/wp'
|
||||
|
||||
export const useGetProductsDetail = (productId: MaybeRef<number>) => {
|
||||
return useQuery({
|
||||
queryKey: ['get-products-detail', productId],
|
||||
queryFn: () => getProductsDetail(unref(productId)),
|
||||
enabled: !!unref(productId),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user