feat: deal attributes editing
This commit is contained in:
@ -59,6 +59,7 @@ import {
|
||||
getBaseMarketplaces,
|
||||
getBoards,
|
||||
getClients,
|
||||
getDealModuleAttributes,
|
||||
getDealProducts,
|
||||
getDeals,
|
||||
getDealServices,
|
||||
@ -85,6 +86,7 @@ import {
|
||||
updateClient,
|
||||
updateDeal,
|
||||
updateDealGroup,
|
||||
updateDealModuleAttributes,
|
||||
updateDealProduct,
|
||||
updateDealProductService,
|
||||
updateDealService,
|
||||
@ -234,6 +236,7 @@ import type {
|
||||
GetBaseMarketplacesData,
|
||||
GetBoardsData,
|
||||
GetClientsData,
|
||||
GetDealModuleAttributesData,
|
||||
GetDealProductsData,
|
||||
GetDealsData,
|
||||
GetDealsError,
|
||||
@ -284,6 +287,9 @@ import type {
|
||||
UpdateDealGroupData,
|
||||
UpdateDealGroupError,
|
||||
UpdateDealGroupResponse2,
|
||||
UpdateDealModuleAttributesData,
|
||||
UpdateDealModuleAttributesError,
|
||||
UpdateDealModuleAttributesResponse2,
|
||||
UpdateDealProductData,
|
||||
UpdateDealProductError,
|
||||
UpdateDealProductResponse2,
|
||||
@ -569,6 +575,81 @@ export const getAttributeTypesOptions = (
|
||||
});
|
||||
};
|
||||
|
||||
export const getDealModuleAttributesQueryKey = (
|
||||
options: Options<GetDealModuleAttributesData>
|
||||
) => createQueryKey("getDealModuleAttributes", options);
|
||||
|
||||
/**
|
||||
* Get Deal Module Attributes
|
||||
*/
|
||||
export const getDealModuleAttributesOptions = (
|
||||
options: Options<GetDealModuleAttributesData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getDealModuleAttributes({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getDealModuleAttributesQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const updateDealModuleAttributesQueryKey = (
|
||||
options: Options<UpdateDealModuleAttributesData>
|
||||
) => createQueryKey("updateDealModuleAttributes", options);
|
||||
|
||||
/**
|
||||
* Update Deal Module Attributes
|
||||
*/
|
||||
export const updateDealModuleAttributesOptions = (
|
||||
options: Options<UpdateDealModuleAttributesData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await updateDealModuleAttributes({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: updateDealModuleAttributesQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update Deal Module Attributes
|
||||
*/
|
||||
export const updateDealModuleAttributesMutation = (
|
||||
options?: Partial<Options<UpdateDealModuleAttributesData>>
|
||||
): UseMutationOptions<
|
||||
UpdateDealModuleAttributesResponse2,
|
||||
AxiosError<UpdateDealModuleAttributesError>,
|
||||
Options<UpdateDealModuleAttributesData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
UpdateDealModuleAttributesResponse2,
|
||||
AxiosError<UpdateDealModuleAttributesError>,
|
||||
Options<UpdateDealModuleAttributesData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await updateDealModuleAttributes({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getBoardsQueryKey = (options: Options<GetBoardsData>) =>
|
||||
createQueryKey("getBoards", options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user