fix: make packages/medusa/src/api/routes/store/carts pass eslint (#652)
This commit is contained in:
1 parent
2c415ea520
commit
1ba63cce08
16 files changed
-59
No files matched your search
@@ -26,7 +26,6 @@
|
|||||||
/packages/medusa/src/api/routes/admin/collections
|
/packages/medusa/src/api/routes/admin/collections
|
||||||
/packages/medusa/src/api/routes/admin/notes
|
/packages/medusa/src/api/routes/admin/notes
|
||||||
/packages/medusa/src/api/routes/admin/store
|
/packages/medusa/src/api/routes/admin/store
|
||||||
/packages/medusa/src/api/routes/store/carts
|
|
||||||
/packages/medusa/src/api/routes/store/return-reasons
|
/packages/medusa/src/api/routes/store/return-reasons
|
||||||
/packages/medusa/src/api/routes/store/returns
|
/packages/medusa/src/api/routes/store/returns
|
||||||
/packages/medusa/src/api/routes/store/swaps
|
/packages/medusa/src/api/routes/store/swaps
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import _ from "lodash"
|
|
||||||
import { Validator, MedusaError } from "medusa-core-utils"
|
import { Validator, MedusaError } from "medusa-core-utils"
|
||||||
import { defaultFields, defaultRelations } from "./"
|
import { defaultFields, defaultRelations } from "./"
|
||||||
|
|
||||||
@@ -36,7 +35,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const manager = req.scope.resolve("manager")
|
const manager = req.scope.resolve("manager")
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
@@ -60,7 +58,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart: updatedCart })
|
res.status(200).json({ cart: updatedCart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,6 @@ export default async (req, res) => {
|
|||||||
res.setHeader("Access-Control-Expose-Headers", "Idempotency-Key")
|
res.setHeader("Access-Control-Expose-Headers", "Idempotency-Key")
|
||||||
res.setHeader("Idempotency-Key", idempotencyKey.idempotency_key)
|
res.setHeader("Idempotency-Key", idempotencyKey.idempotency_key)
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
const orderService = req.scope.resolve("orderService")
|
const orderService = req.scope.resolve("orderService")
|
||||||
const swapService = req.scope.resolve("swapService")
|
const swapService = req.scope.resolve("swapService")
|
||||||
@@ -276,7 +275,4 @@ export default async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.status(idempotencyKey.response_code).json(idempotencyKey.response_body)
|
res.status(idempotencyKey.response_code).json(idempotencyKey.response_body)
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,6 @@ export default async (req, res) => {
|
|||||||
user_agent: req.get("user-agent"),
|
user_agent: req.get("user-agent"),
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const lineItemService = req.scope.resolve("lineItemService")
|
const lineItemService = req.scope.resolve("lineItemService")
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
@@ -137,7 +136,4 @@ export default async (req, res) => {
|
|||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
})
|
})
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const manager = req.scope.resolve("manager")
|
const manager = req.scope.resolve("manager")
|
||||||
const lineItemService = req.scope.resolve("lineItemService")
|
const lineItemService = req.scope.resolve("lineItemService")
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
@@ -69,7 +68,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,6 @@ import { defaultFields, defaultRelations } from "./"
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
await cartService.setPaymentSessions(id)
|
await cartService.setPaymentSessions(id)
|
||||||
@@ -33,7 +32,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import { defaultFields, defaultRelations } from "./"
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, code } = req.params
|
const { id, code } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const manager = req.scope.resolve("manager")
|
const manager = req.scope.resolve("manager")
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
@@ -47,7 +46,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import { defaultFields, defaultRelations } from "./"
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, line_id } = req.params
|
const { id, line_id } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const manager = req.scope.resolve("manager")
|
const manager = req.scope.resolve("manager")
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
@@ -47,7 +46,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import { defaultFields, defaultRelations } from "./"
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, provider_id } = req.params
|
const { id, provider_id } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
await cartService.deletePaymentSession(id, provider_id)
|
await cartService.deletePaymentSession(id, provider_id)
|
||||||
@@ -33,7 +32,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,6 @@ import { defaultFields, defaultRelations } from "./"
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
let cart = await cartService.retrieve(id, {
|
let cart = await cartService.retrieve(id, {
|
||||||
@@ -48,7 +47,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.json({ cart })
|
res.json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { id, provider_id } = req.params
|
const { id, provider_id } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
await cartService.refreshPaymentSession(id, provider_id)
|
await cartService.refreshPaymentSession(id, provider_id)
|
||||||
@@ -44,7 +43,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
let cart = await cartService.setPaymentSession(id, value.provider_id)
|
let cart = await cartService.setPaymentSession(id, value.provider_id)
|
||||||
@@ -43,7 +42,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import _ from "lodash"
|
|
||||||
import { Validator, MedusaError } from "medusa-core-utils"
|
import { Validator, MedusaError } from "medusa-core-utils"
|
||||||
|
|
||||||
import { defaultFields, defaultRelations } from "./"
|
import { defaultFields, defaultRelations } from "./"
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const manager = req.scope.resolve("manager")
|
const manager = req.scope.resolve("manager")
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
@@ -80,7 +79,4 @@ export default async (req, res) => {
|
|||||||
relations: defaultRelations,
|
relations: defaultRelations,
|
||||||
})
|
})
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
let cart = await cartService.setPaymentMethod(id, value)
|
let cart = await cartService.setPaymentMethod(id, value)
|
||||||
@@ -24,7 +23,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,6 @@ export default async (req, res) => {
|
|||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const cartService = req.scope.resolve("cartService")
|
const cartService = req.scope.resolve("cartService")
|
||||||
|
|
||||||
await cartService.setPaymentSession(id, provider_id)
|
await cartService.setPaymentSession(id, provider_id)
|
||||||
@@ -47,7 +46,4 @@ export default async (req, res) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
res.status(200).json({ cart })
|
res.status(200).json({ cart })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user