fix: Add shipping method data validation (#9542)
* fix: Add shipping method data validation * fix: return type
This commit is contained in:
1 parent
6829d3b162
commit
43324b9294
7 files changed
+258
-45
No files matched your search
@@ -1,17 +1,16 @@
|
||||
import { addShippingMethodToWorkflow } from "@medusajs/core-flows"
|
||||
import { addShippingMethodToCartWorkflow } from "@medusajs/core-flows"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
import { refetchCart } from "../../helpers"
|
||||
import { StoreAddCartShippingMethodsType } from "../../validators"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const POST = async (
|
||||
req: MedusaRequest<StoreAddCartShippingMethodsType>,
|
||||
res: MedusaResponse<HttpTypes.StoreCartResponse>
|
||||
) => {
|
||||
const workflow = addShippingMethodToWorkflow(req.scope)
|
||||
const payload = req.validatedBody
|
||||
|
||||
await workflow.run({
|
||||
await addShippingMethodToCartWorkflow(req.scope).run({
|
||||
input: {
|
||||
options: [{ id: payload.option_id, data: payload.data }],
|
||||
cart_id: req.params.id,
|
||||
|
||||
Reference in new issue
Block a user