feat: marketplaces editor in clients page
This commit is contained in:
@ -18,6 +18,7 @@ import {
|
||||
createDealProduct,
|
||||
createDealProductService,
|
||||
createDealService,
|
||||
createMarketplace,
|
||||
createProduct,
|
||||
createProject,
|
||||
createService,
|
||||
@ -31,6 +32,7 @@ import {
|
||||
deleteDealProduct,
|
||||
deleteDealProductService,
|
||||
deleteDealService,
|
||||
deleteMarketplace,
|
||||
deleteProduct,
|
||||
deleteProject,
|
||||
deleteService,
|
||||
@ -41,12 +43,14 @@ import {
|
||||
getBarcodeTemplateAttributes,
|
||||
getBarcodeTemplates,
|
||||
getBarcodeTemplateSizes,
|
||||
getBaseMarketplaces,
|
||||
getBoards,
|
||||
getBuiltInModules,
|
||||
getClients,
|
||||
getDealProducts,
|
||||
getDeals,
|
||||
getDealServices,
|
||||
getMarketplaces,
|
||||
getProductBarcodePdf,
|
||||
getProducts,
|
||||
getProjects,
|
||||
@ -62,6 +66,7 @@ import {
|
||||
updateDealProduct,
|
||||
updateDealProductService,
|
||||
updateDealService,
|
||||
updateMarketplace,
|
||||
updateProduct,
|
||||
updateProject,
|
||||
updateService,
|
||||
@ -98,6 +103,9 @@ import type {
|
||||
CreateDealServiceData,
|
||||
CreateDealServiceError,
|
||||
CreateDealServiceResponse2,
|
||||
CreateMarketplaceData,
|
||||
CreateMarketplaceError,
|
||||
CreateMarketplaceResponse2,
|
||||
CreateProductData,
|
||||
CreateProductError,
|
||||
CreateProductResponse2,
|
||||
@ -137,6 +145,9 @@ import type {
|
||||
DeleteDealServiceData,
|
||||
DeleteDealServiceError,
|
||||
DeleteDealServiceResponse2,
|
||||
DeleteMarketplaceData,
|
||||
DeleteMarketplaceError,
|
||||
DeleteMarketplaceResponse2,
|
||||
DeleteProductData,
|
||||
DeleteProductError,
|
||||
DeleteProductResponse2,
|
||||
@ -161,6 +172,7 @@ import type {
|
||||
GetBarcodeTemplateAttributesData,
|
||||
GetBarcodeTemplatesData,
|
||||
GetBarcodeTemplateSizesData,
|
||||
GetBaseMarketplacesData,
|
||||
GetBoardsData,
|
||||
GetBuiltInModulesData,
|
||||
GetClientsData,
|
||||
@ -169,6 +181,7 @@ import type {
|
||||
GetDealsError,
|
||||
GetDealServicesData,
|
||||
GetDealsResponse2,
|
||||
GetMarketplacesData,
|
||||
GetProductBarcodePdfData,
|
||||
GetProductBarcodePdfError,
|
||||
GetProductBarcodePdfResponse2,
|
||||
@ -202,6 +215,9 @@ import type {
|
||||
UpdateDealServiceData,
|
||||
UpdateDealServiceError,
|
||||
UpdateDealServiceResponse2,
|
||||
UpdateMarketplaceData,
|
||||
UpdateMarketplaceError,
|
||||
UpdateMarketplaceResponse2,
|
||||
UpdateProductData,
|
||||
UpdateProductError,
|
||||
UpdateProductResponse2,
|
||||
@ -1696,6 +1712,159 @@ export const addKitToDealMutation = (
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getBaseMarketplacesQueryKey = (
|
||||
options?: Options<GetBaseMarketplacesData>
|
||||
) => createQueryKey("getBaseMarketplaces", options);
|
||||
|
||||
/**
|
||||
* Get Base Marketplaces
|
||||
*/
|
||||
export const getBaseMarketplacesOptions = (
|
||||
options?: Options<GetBaseMarketplacesData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getBaseMarketplaces({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getBaseMarketplacesQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const getMarketplacesQueryKey = (
|
||||
options: Options<GetMarketplacesData>
|
||||
) => createQueryKey("getMarketplaces", options);
|
||||
|
||||
/**
|
||||
* Get Marketplaces
|
||||
*/
|
||||
export const getMarketplacesOptions = (
|
||||
options: Options<GetMarketplacesData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getMarketplaces({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getMarketplacesQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const createMarketplaceQueryKey = (
|
||||
options: Options<CreateMarketplaceData>
|
||||
) => createQueryKey("createMarketplace", options);
|
||||
|
||||
/**
|
||||
* Create Product
|
||||
*/
|
||||
export const createMarketplaceOptions = (
|
||||
options: Options<CreateMarketplaceData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await createMarketplace({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: createMarketplaceQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Product
|
||||
*/
|
||||
export const createMarketplaceMutation = (
|
||||
options?: Partial<Options<CreateMarketplaceData>>
|
||||
): UseMutationOptions<
|
||||
CreateMarketplaceResponse2,
|
||||
AxiosError<CreateMarketplaceError>,
|
||||
Options<CreateMarketplaceData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
CreateMarketplaceResponse2,
|
||||
AxiosError<CreateMarketplaceError>,
|
||||
Options<CreateMarketplaceData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await createMarketplace({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete Marketplace
|
||||
*/
|
||||
export const deleteMarketplaceMutation = (
|
||||
options?: Partial<Options<DeleteMarketplaceData>>
|
||||
): UseMutationOptions<
|
||||
DeleteMarketplaceResponse2,
|
||||
AxiosError<DeleteMarketplaceError>,
|
||||
Options<DeleteMarketplaceData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
DeleteMarketplaceResponse2,
|
||||
AxiosError<DeleteMarketplaceError>,
|
||||
Options<DeleteMarketplaceData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await deleteMarketplace({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update Marketplace
|
||||
*/
|
||||
export const updateMarketplaceMutation = (
|
||||
options?: Partial<Options<UpdateMarketplaceData>>
|
||||
): UseMutationOptions<
|
||||
UpdateMarketplaceResponse2,
|
||||
AxiosError<UpdateMarketplaceError>,
|
||||
Options<UpdateMarketplaceData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
UpdateMarketplaceResponse2,
|
||||
AxiosError<UpdateMarketplaceError>,
|
||||
Options<UpdateMarketplaceData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await updateMarketplace({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
|
||||
createQueryKey("getProducts", options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user