Delete and Edit Vendor

This commit is contained in:
efrilm
2025-09-12 15:23:19 +07:00
parent c91be1812b
commit 40c417ec72
5 changed files with 237 additions and 112 deletions
+11 -1
View File
@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query'
import { api } from '../api'
import { Vendors } from '@/types/services/vendor'
import { Vendor, Vendors } from '@/types/services/vendor'
interface VendorQueryParams {
page?: number
@@ -34,3 +34,13 @@ export function useVendors(params: VendorQueryParams = {}) {
}
})
}
export function useVendorById(id: string) {
return useQuery<Vendor>({
queryKey: ['vendors', id],
queryFn: async () => {
const res = await api.get(`/vendors/${id}`)
return res.data.data
}
})
}