feat(dashboard): shipping & location (#7151)
This commit is contained in:
@@ -14,6 +14,7 @@ import { productTypes } from "./product-types"
|
||||
import { products } from "./products"
|
||||
import { promotions } from "./promotions"
|
||||
import { regions } from "./regions"
|
||||
import { fulfillmentProviders } from "./fulfillment-providers"
|
||||
import { reservations } from "./reservations"
|
||||
import { salesChannels } from "./sales-channels"
|
||||
import { shippingOptions } from "./shipping-options"
|
||||
@@ -47,6 +48,7 @@ export const client = {
|
||||
invites: invites,
|
||||
inventoryItems: inventoryItems,
|
||||
reservations: reservations,
|
||||
fulfillmentProviders: fulfillmentProviders,
|
||||
products: products,
|
||||
productTypes: productTypes,
|
||||
priceLists: priceLists,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { getRequest } from "./common"
|
||||
import { FulfillmentProvidersListRes } from "../../types/api-responses"
|
||||
|
||||
async function listFulfillmentProviders(query?: Record<string, any>) {
|
||||
return getRequest<FulfillmentProvidersListRes>(
|
||||
`/admin/fulfillment-providers`,
|
||||
query
|
||||
)
|
||||
}
|
||||
|
||||
export const fulfillmentProviders = {
|
||||
list: listFulfillmentProviders,
|
||||
}
|
||||
@@ -1,14 +1,32 @@
|
||||
import { deleteRequest, postRequest } from "./common"
|
||||
import { deleteRequest, getRequest, postRequest } from "./common"
|
||||
import {
|
||||
ShippingOptionDeleteRes,
|
||||
ShippingOptionListRes,
|
||||
ShippingOptionRes,
|
||||
} from "../../types/api-responses"
|
||||
import { CreateShippingOptionReq } from "../../types/api-payloads"
|
||||
import {
|
||||
CreateShippingOptionReq,
|
||||
UpdateShippingOptionReq,
|
||||
} from "../../types/api-payloads"
|
||||
|
||||
async function createShippingOptions(payload: CreateShippingOptionReq) {
|
||||
return postRequest<ShippingOptionRes>(`/admin/shipping-options`, payload)
|
||||
}
|
||||
|
||||
async function updateShippingOptions(
|
||||
id: string,
|
||||
payload: UpdateShippingOptionReq
|
||||
) {
|
||||
return postRequest<ShippingOptionRes>(
|
||||
`/admin/shipping-options/${id}`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
async function listShippingOptions(query?: Record<string, any>) {
|
||||
return getRequest<ShippingOptionListRes>(`/admin/shipping-options`, query)
|
||||
}
|
||||
|
||||
async function deleteShippingOption(optionId: string) {
|
||||
return deleteRequest<ShippingOptionDeleteRes>(
|
||||
`/admin/shipping-options/${optionId}`
|
||||
@@ -17,5 +35,7 @@ async function deleteShippingOption(optionId: string) {
|
||||
|
||||
export const shippingOptions = {
|
||||
create: createShippingOptions,
|
||||
update: updateShippingOptions,
|
||||
delete: deleteShippingOption,
|
||||
list: listShippingOptions,
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ import {
|
||||
CreateFulfillmentSetReq,
|
||||
CreateServiceZoneReq,
|
||||
CreateStockLocationReq,
|
||||
UpdateServiceZoneReq,
|
||||
UpdateStockLocationReq,
|
||||
UpdateStockLocationSalesChannelsReq,
|
||||
} from "../../types/api-payloads"
|
||||
import {
|
||||
FulfillmentSetDeleteRes,
|
||||
@@ -45,6 +47,17 @@ async function createServiceZone(
|
||||
)
|
||||
}
|
||||
|
||||
async function updateServiceZone(
|
||||
fulfillmentSetId: string,
|
||||
serviceZoneId: string,
|
||||
payload: UpdateServiceZoneReq
|
||||
) {
|
||||
return postRequest<StockLocationRes>(
|
||||
`/admin/fulfillment-sets/${fulfillmentSetId}/service-zones/${serviceZoneId}`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
async function updateStockLocation(
|
||||
id: string,
|
||||
payload: UpdateStockLocationReq
|
||||
@@ -52,6 +65,16 @@ async function updateStockLocation(
|
||||
return postRequest<StockLocationRes>(`/admin/stock-locations/${id}`, payload)
|
||||
}
|
||||
|
||||
async function updateStockLocationSalesChannels(
|
||||
id: string,
|
||||
payload: UpdateStockLocationSalesChannelsReq
|
||||
) {
|
||||
return postRequest<StockLocationRes>(
|
||||
`/admin/stock-locations/${id}/sales-channels`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
async function deleteStockLocation(id: string) {
|
||||
return deleteRequest<StockLocationDeleteRes>(`/admin/stock-locations/${id}`)
|
||||
}
|
||||
@@ -74,8 +97,10 @@ export const stockLocations = {
|
||||
create: createStockLocation,
|
||||
update: updateStockLocation,
|
||||
delete: deleteStockLocation,
|
||||
updateSalesChannels: updateStockLocationSalesChannels,
|
||||
createFulfillmentSet,
|
||||
deleteFulfillmentSet,
|
||||
createServiceZone,
|
||||
deleteServiceZone,
|
||||
updateServiceZone,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user