feat(sdk): Type all store endpoints in the SDK (#7375)

The typings will need further refinement, but we can do that once closer to a public release
This commit is contained in:
Stevche Radevski authored and GitHub committed 2024-05-20 19:41:58 +00:00
1 parent f57dc98c7a
commit 2371626198
16 files changed
+1447 -302

No files matched your search

@@ -7,6 +7,7 @@ import { MedusaRequest, MedusaResponse } from "../../../../../../types/routing"
import { refetchCart } from "../../../helpers"
import { StoreUpdateCartLineItemType } from "../../../validators"
import { prepareListQuery } from "../../../../../../utils/get-query-config"
import { DeleteResponse } from "@medusajs/types"
export const POST = async (
req: MedusaRequest<StoreUpdateCartLineItemType>,
@@ -62,7 +63,10 @@ export const POST = async (
res.status(200).json({ cart: updatedCart })
}
export const DELETE = async (req: MedusaRequest, res: MedusaResponse) => {
export const DELETE = async (
req: MedusaRequest,
res: MedusaResponse<DeleteResponse<"line-item">>
) => {
const id = req.params.line_id
const { errors } = await deleteLineItemsWorkflow(req.scope).run({
@@ -80,5 +84,10 @@ export const DELETE = async (req: MedusaRequest, res: MedusaResponse) => {
req.remoteQueryConfig.fields
)
res.status(200).json({ cart })
res.status(200).json({
id: id,
object: "line-item",
deleted: true,
parent: cart,
})
}