feat(medusa): Support batch remove resources on discount condition (#2444)
**what** - Add support to remove resources by batch on discount conditions - Add support on medusa-js and medusa-react **Tests** - Add integration tests to validate that the resources have been deleted and the length is the one expected - Add unit tests on medusa react FIXES CORE-609
This commit is contained in:
committed by
GitHub
parent
765a2cccda
commit
48411157b1
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
AdminDeleteDiscountsDiscountConditionsConditionBatchReq,
|
||||
AdminDiscountsDeleteRes,
|
||||
AdminDiscountsRes,
|
||||
AdminPostDiscountsDiscountConditions,
|
||||
@@ -39,6 +40,29 @@ export const useAdminAddDiscountConditionResourceBatch = (
|
||||
)
|
||||
}
|
||||
|
||||
export const useAdminDeleteDiscountConditionResourceBatch = (
|
||||
discountId: string,
|
||||
conditionId: string,
|
||||
options?: UseMutationOptions<
|
||||
Response<AdminDiscountsRes>,
|
||||
Error,
|
||||
AdminDeleteDiscountsDiscountConditionsConditionBatchReq
|
||||
>
|
||||
) => {
|
||||
const { client } = useMedusa()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation(
|
||||
(payload: AdminDeleteDiscountsDiscountConditionsConditionBatchReq) =>
|
||||
client.admin.discounts.deleteConditionResourceBatch(
|
||||
discountId,
|
||||
conditionId,
|
||||
payload
|
||||
),
|
||||
buildOptions(queryClient, [adminDiscountKeys.detail(discountId)], options)
|
||||
)
|
||||
}
|
||||
|
||||
export const useAdminCreateDiscount = (
|
||||
options?: UseMutationOptions<
|
||||
Response<AdminDiscountsRes>,
|
||||
|
||||
Reference in New Issue
Block a user