fix: Standardize remaining batch methods and update FE calls (#7122)
This commit is contained in:
@@ -32,8 +32,10 @@ const batchRemoveSalesChannelsFromApiKey = async (
|
||||
payload: { sales_channel_ids: string[] }
|
||||
) => {
|
||||
return postRequest<AdminApiKeyResponse>(
|
||||
`/admin/api-keys/${id}/sales-channels/batch/remove`,
|
||||
payload
|
||||
`/admin/api-keys/${id}/sales-channels`,
|
||||
{
|
||||
remove: payload.sales_channel_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -42,8 +44,10 @@ const batchAddSalesChannelsFromApiKey = async (
|
||||
payload: { sales_channel_ids: string[] }
|
||||
) => {
|
||||
return postRequest<AdminApiKeyResponse>(
|
||||
`/admin/api-keys/${id}/sales-channels/batch/add`,
|
||||
payload
|
||||
`/admin/api-keys/${id}/sales-channels`,
|
||||
{
|
||||
add: payload.sales_channel_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,10 @@ async function batchAddCustomers(
|
||||
payload: { customer_ids: { id: string }[] }
|
||||
) {
|
||||
return postRequest<AdminCustomerGroupResponse>(
|
||||
`/admin/customer-groups/${id}/customers/batch/add`,
|
||||
payload
|
||||
`/admin/customer-groups/${id}/customers`,
|
||||
{
|
||||
add: payload.customer_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -63,8 +65,10 @@ async function batchRemoveCustomers(
|
||||
payload: { customer_ids: { id: string }[] }
|
||||
) {
|
||||
return postRequest<AdminCustomerGroupResponse>(
|
||||
`/admin/customer-groups/${id}/customers/batch/remove`,
|
||||
payload
|
||||
`/admin/customer-groups/${id}/customers`,
|
||||
{
|
||||
remove: payload.customer_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,11 @@ async function batchPostLocationLevels(
|
||||
payload: InventoryItemLocationBatch
|
||||
) {
|
||||
return postRequest<AdminInventoryLevelResponse>(
|
||||
`/admin/inventory-items/${inventoryItemId}/location-levels/batch/combi`,
|
||||
payload
|
||||
`/admin/inventory-items/${inventoryItemId}/location-levels/batch`,
|
||||
{
|
||||
create: payload.creates,
|
||||
delete: payload.deletes,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -32,20 +32,18 @@ async function deletePriceList(id: string) {
|
||||
}
|
||||
|
||||
async function addPriceListPrices(id: string, payload: AddPriceListPricesReq) {
|
||||
return postRequest<PriceListRes>(
|
||||
`/admin/price-lists/${id}/prices/batch/add`,
|
||||
payload
|
||||
)
|
||||
return postRequest<PriceListRes>(`/admin/price-lists/${id}/prices/batch`, {
|
||||
create: payload.prices,
|
||||
})
|
||||
}
|
||||
|
||||
async function removePriceListPrices(
|
||||
id: string,
|
||||
payload: DeletePriceListPricesReq
|
||||
) {
|
||||
return postRequest<PriceListRes>(
|
||||
`/admin/price-lists/${id}/prices/batch/remove`,
|
||||
payload
|
||||
)
|
||||
return postRequest<PriceListRes>(`/admin/price-lists/${id}/prices/batch`, {
|
||||
delete: payload.ids,
|
||||
})
|
||||
}
|
||||
|
||||
export const priceLists = {
|
||||
|
||||
@@ -46,8 +46,10 @@ async function addPromotionRules(
|
||||
payload: BatchAddPromotionRulesReq
|
||||
) {
|
||||
return postRequest<PromotionRes>(
|
||||
`/admin/promotions/${id}/${ruleType}/batch/add`,
|
||||
payload
|
||||
`/admin/promotions/${id}/${ruleType}/batch`,
|
||||
{
|
||||
create: payload.rules,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -57,8 +59,10 @@ async function updatePromotionRules(
|
||||
payload: BatchUpdatePromotionRulesReq
|
||||
) {
|
||||
return postRequest<PromotionRes>(
|
||||
`/admin/promotions/${id}/${ruleType}/batch/update`,
|
||||
payload
|
||||
`/admin/promotions/${id}/${ruleType}/batch`,
|
||||
{
|
||||
update: payload.rules,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -68,8 +72,10 @@ async function removePromotionRules(
|
||||
payload: BatchRemovePromotionRulesReq
|
||||
) {
|
||||
return postRequest<PromotionRes>(
|
||||
`/admin/promotions/${id}/${ruleType}/batch/remove`,
|
||||
payload
|
||||
`/admin/promotions/${id}/${ruleType}/batch`,
|
||||
{
|
||||
delete: payload.rule_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,10 @@ async function batchRemoveProducts(
|
||||
payload: RemoveProductsSalesChannelReq
|
||||
) {
|
||||
return postRequest<AdminSalesChannelResponse>(
|
||||
`/admin/sales-channels/${id}/products/batch/remove`,
|
||||
payload
|
||||
`/admin/sales-channels/${id}/products`,
|
||||
{
|
||||
remove: payload.product_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -58,8 +60,10 @@ async function batchAddProducts(
|
||||
payload: AddProductsSalesChannelReq
|
||||
) {
|
||||
return postRequest<AdminSalesChannelResponse>(
|
||||
`/admin/sales-channels/${id}/products/batch/add`,
|
||||
payload
|
||||
`/admin/sales-channels/${id}/products`,
|
||||
{
|
||||
add: payload.product_ids,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user