feat(dashboard): manage inventory items for variants (#7800)
* feat: manage inventory items for variants * fix: show action only when manage inventory * fix: translation key * fix: labels depending on number of items * fix: address feedback --------- Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
co-authored by
Sebastian Rindom
parent
4945c79818
commit
8703f453be
@@ -185,6 +185,27 @@ export const useUpdateProductVariantsBatch = (
|
||||
})
|
||||
}
|
||||
|
||||
export const useProductVariantsInventoryItemsBatch = (
|
||||
productId: string,
|
||||
options?: UseMutationOptions<any, Error, any>
|
||||
) => {
|
||||
return useMutation({
|
||||
mutationFn: (
|
||||
payload: HttpTypes.AdminBatchProductVariantInventoryItemRequest
|
||||
) => sdk.admin.product.batchVariantInventoryItems(productId, payload),
|
||||
onSuccess: (data: any, variables: any, context: any) => {
|
||||
queryClient.invalidateQueries({ queryKey: variantsQueryKeys.lists() })
|
||||
queryClient.invalidateQueries({ queryKey: variantsQueryKeys.details() })
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: productsQueryKeys.detail(productId),
|
||||
})
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
export const useDeleteVariant = (
|
||||
productId: string,
|
||||
variantId: string,
|
||||
|
||||
Reference in New Issue
Block a user