12 lines
365 B
TypeScript
12 lines
365 B
TypeScript
import { useQuery } from '@tanstack/vue-query'
|
|
import { unref } from 'vue'
|
|
import { getProductsDetail } from '~/api/endpoints'
|
|
|
|
export const useGetProductsDetail = (productId: MaybeRef<number>) => {
|
|
return useQuery({
|
|
queryKey: ['get-products-detail', productId],
|
|
queryFn: () => getProductsDetail(unref(productId)),
|
|
enabled: !!unref(productId),
|
|
})
|
|
}
|