feat: product barcode images
This commit is contained in:
@ -39,6 +39,7 @@ import {
|
||||
deleteDealTag,
|
||||
deleteMarketplace,
|
||||
deleteProduct,
|
||||
deleteProductBarcodeImage,
|
||||
deleteProject,
|
||||
deleteService,
|
||||
deleteServiceCategory,
|
||||
@ -84,6 +85,7 @@ import {
|
||||
updateServiceCategory,
|
||||
updateServicesKit,
|
||||
updateStatus,
|
||||
uploadProductBarcodeImage,
|
||||
uploadProductImage,
|
||||
type Options,
|
||||
} from "../sdk.gen";
|
||||
@ -172,6 +174,9 @@ import type {
|
||||
DeleteMarketplaceData,
|
||||
DeleteMarketplaceError,
|
||||
DeleteMarketplaceResponse2,
|
||||
DeleteProductBarcodeImageData,
|
||||
DeleteProductBarcodeImageError,
|
||||
DeleteProductBarcodeImageResponse,
|
||||
DeleteProductData,
|
||||
DeleteProductError,
|
||||
DeleteProductResponse2,
|
||||
@ -275,6 +280,9 @@ import type {
|
||||
UpdateStatusData,
|
||||
UpdateStatusError,
|
||||
UpdateStatusResponse2,
|
||||
UploadProductBarcodeImageData,
|
||||
UploadProductBarcodeImageError,
|
||||
UploadProductBarcodeImageResponse,
|
||||
UploadProductImageData,
|
||||
UploadProductImageError,
|
||||
UploadProductImageResponse,
|
||||
@ -2292,6 +2300,84 @@ export const getProductBarcodePdfMutation = (
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const uploadProductBarcodeImageQueryKey = (
|
||||
options: Options<UploadProductBarcodeImageData>
|
||||
) => createQueryKey("uploadProductBarcodeImage", options);
|
||||
|
||||
/**
|
||||
* Upload Product Barcode Image
|
||||
*/
|
||||
export const uploadProductBarcodeImageOptions = (
|
||||
options: Options<UploadProductBarcodeImageData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await uploadProductBarcodeImage({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: uploadProductBarcodeImageQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Upload Product Barcode Image
|
||||
*/
|
||||
export const uploadProductBarcodeImageMutation = (
|
||||
options?: Partial<Options<UploadProductBarcodeImageData>>
|
||||
): UseMutationOptions<
|
||||
UploadProductBarcodeImageResponse,
|
||||
AxiosError<UploadProductBarcodeImageError>,
|
||||
Options<UploadProductBarcodeImageData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
UploadProductBarcodeImageResponse,
|
||||
AxiosError<UploadProductBarcodeImageError>,
|
||||
Options<UploadProductBarcodeImageData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await uploadProductBarcodeImage({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete Product Barcode Image
|
||||
*/
|
||||
export const deleteProductBarcodeImageMutation = (
|
||||
options?: Partial<Options<DeleteProductBarcodeImageData>>
|
||||
): UseMutationOptions<
|
||||
DeleteProductBarcodeImageResponse,
|
||||
AxiosError<DeleteProductBarcodeImageError>,
|
||||
Options<DeleteProductBarcodeImageData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
DeleteProductBarcodeImageResponse,
|
||||
AxiosError<DeleteProductBarcodeImageError>,
|
||||
Options<DeleteProductBarcodeImageData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await deleteProductBarcodeImage({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getServicesQueryKey = (options?: Options<GetServicesData>) =>
|
||||
createQueryKey("getServices", options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user