feat: barcodes printing
This commit is contained in:
@ -47,6 +47,7 @@ import {
|
||||
getDealProducts,
|
||||
getDeals,
|
||||
getDealServices,
|
||||
getProductBarcodePdf,
|
||||
getProducts,
|
||||
getProjects,
|
||||
getServiceCategories,
|
||||
@ -168,6 +169,9 @@ import type {
|
||||
GetDealsError,
|
||||
GetDealServicesData,
|
||||
GetDealsResponse2,
|
||||
GetProductBarcodePdfData,
|
||||
GetProductBarcodePdfError,
|
||||
GetProductBarcodePdfResponse2,
|
||||
GetProductsData,
|
||||
GetProductsError,
|
||||
GetProductsResponse2,
|
||||
@ -1867,6 +1871,57 @@ export const updateProductMutation = (
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getProductBarcodePdfQueryKey = (
|
||||
options: Options<GetProductBarcodePdfData>
|
||||
) => createQueryKey("getProductBarcodePdf", options);
|
||||
|
||||
/**
|
||||
* Get Product Barcode Pdf
|
||||
*/
|
||||
export const getProductBarcodePdfOptions = (
|
||||
options: Options<GetProductBarcodePdfData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getProductBarcodePdf({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getProductBarcodePdfQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Product Barcode Pdf
|
||||
*/
|
||||
export const getProductBarcodePdfMutation = (
|
||||
options?: Partial<Options<GetProductBarcodePdfData>>
|
||||
): UseMutationOptions<
|
||||
GetProductBarcodePdfResponse2,
|
||||
AxiosError<GetProductBarcodePdfError>,
|
||||
Options<GetProductBarcodePdfData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
GetProductBarcodePdfResponse2,
|
||||
AxiosError<GetProductBarcodePdfError>,
|
||||
Options<GetProductBarcodePdfData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await getProductBarcodePdf({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getServicesQueryKey = (options?: Options<GetServicesData>) =>
|
||||
createQueryKey("getServices", options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user