fix: make packages/medusa/src/api/routes/admin/shipping-profiles pass eslint (#642)
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
/packages/medusa/src/api/routes/admin/collections
|
||||
/packages/medusa/src/api/routes/admin/notes
|
||||
/packages/medusa/src/api/routes/admin/orders
|
||||
/packages/medusa/src/api/routes/admin/shipping-profiles
|
||||
/packages/medusa/src/api/routes/admin/store
|
||||
/packages/medusa/src/api/routes/store/carts
|
||||
/packages/medusa/src/api/routes/store/return-reasons
|
||||
|
||||
@@ -35,12 +35,8 @@ export default async (req, res) => {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
const data = await profileService.create(value)
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
const data = await profileService.create(value)
|
||||
|
||||
res.status(200).json({ shipping_profile: data })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
res.status(200).json({ shipping_profile: data })
|
||||
}
|
||||
|
||||
@@ -25,17 +25,13 @@
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const { profile_id } = req.params
|
||||
try {
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
|
||||
await profileService.delete(profile_id)
|
||||
await profileService.delete(profile_id)
|
||||
|
||||
res.status(200).json({
|
||||
id: profile_id,
|
||||
object: "shipping_profile",
|
||||
deleted: true,
|
||||
})
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
res.status(200).json({
|
||||
id: profile_id,
|
||||
object: "shipping_profile",
|
||||
deleted: true,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,16 +21,12 @@ import { defaultFields, defaultRelations } from "./"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const { profile_id } = req.params
|
||||
try {
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
|
||||
const profile = await profileService.retrieve(profile_id, {
|
||||
select: defaultFields,
|
||||
relations: defaultRelations,
|
||||
})
|
||||
const profile = await profileService.retrieve(profile_id, {
|
||||
select: defaultFields,
|
||||
relations: defaultRelations,
|
||||
})
|
||||
|
||||
res.status(200).json({ shipping_profile: profile })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
res.status(200).json({ shipping_profile: profile })
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import middlewares from "../../../middlewares"
|
||||
|
||||
const route = Router()
|
||||
|
||||
export default app => {
|
||||
export default (app) => {
|
||||
app.use("/shipping-profiles", route)
|
||||
|
||||
route.get("/", middlewares.wrap(require("./list-shipping-profiles").default))
|
||||
|
||||
@@ -18,13 +18,9 @@
|
||||
* $ref: "#/components/schemas/shipping_profile"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
try {
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
|
||||
const data = await profileService.list()
|
||||
const data = await profileService.list()
|
||||
|
||||
res.status(200).json({ shipping_profiles: data })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
res.status(200).json({ shipping_profiles: data })
|
||||
}
|
||||
|
||||
@@ -39,14 +39,10 @@ export default async (req, res) => {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
const profileService = req.scope.resolve("shippingProfileService")
|
||||
|
||||
await profileService.update(profile_id, value)
|
||||
await profileService.update(profile_id, value)
|
||||
|
||||
const data = await profileService.retrieve(profile_id)
|
||||
res.status(200).json({ shipping_profile: data })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
const data = await profileService.retrieve(profile_id)
|
||||
res.status(200).json({ shipping_profile: data })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user