fix: /api/routes/store/customers pass linting (#646)
This commit is contained in:
1 parent
5cb1b5687e
commit
7cc94dc479
10 files changed
+4
-44
No files matched your search
@@ -49,7 +49,6 @@
|
||||
|
||||
/packages/medusa/src/api/routes/store/auth
|
||||
/packages/medusa/src/api/routes/store/carts
|
||||
/packages/medusa/src/api/routes/store/customers
|
||||
|
||||
/packages/medusa/src/api/routes/store/regions
|
||||
/packages/medusa/src/api/routes/store/return-reasons
|
||||
|
||||
@@ -41,7 +41,6 @@ export default async (req, res) => {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
|
||||
let customer = await customerService.addAddress(id, value.address)
|
||||
@@ -51,7 +50,4 @@ export default async (req, res) => {
|
||||
})
|
||||
|
||||
res.status(200).json({ customer })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ export default async (req, res) => {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
let customer = await customerService.create(value)
|
||||
|
||||
@@ -55,7 +54,4 @@ export default async (req, res) => {
|
||||
})
|
||||
|
||||
res.status(200).json({ customer })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -25,15 +25,11 @@ export default async (req, res) => {
|
||||
const { address_id } = req.params
|
||||
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
try {
|
||||
await customerService.removeAddress(id, address_id)
|
||||
customer = await customerService.retrieve(id, {
|
||||
const customer = await customerService.retrieve(id, {
|
||||
relations: defaultRelations,
|
||||
select: defaultFields,
|
||||
})
|
||||
|
||||
res.json({ customer })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -19,14 +19,10 @@ import { defaultRelations, defaultFields } from "./"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const id = req.user.customer_id
|
||||
try {
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
const customer = await customerService.retrieve(id, {
|
||||
relations: defaultRelations,
|
||||
select: defaultFields,
|
||||
})
|
||||
res.json({ customer })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const id = req.user.customer_id
|
||||
try {
|
||||
const storeService = req.scope.resolve("storeService")
|
||||
const paymentProviderService = req.scope.resolve("paymentProviderService")
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
@@ -49,7 +48,4 @@ export default async (req, res) => {
|
||||
)
|
||||
|
||||
res.json({ payment_methods: methods.flat() })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import _ from "lodash"
|
||||
import {
|
||||
defaultRelations,
|
||||
defaultFields,
|
||||
@@ -29,7 +28,7 @@ import {
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const id = req.user.customer_id
|
||||
try {
|
||||
|
||||
const orderService = req.scope.resolve("orderService")
|
||||
|
||||
const selector = {
|
||||
@@ -59,13 +58,7 @@ export default async (req, res) => {
|
||||
order: { created_at: "DESC" },
|
||||
}
|
||||
|
||||
const [orders, count] = await orderService.listAndCount(
|
||||
selector,
|
||||
listConfig
|
||||
)
|
||||
const [orders, count] = await orderService.listAndCount(selector, listConfig)
|
||||
|
||||
res.json({ orders, count, offset, limit })
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ export default async (req, res) => {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
const customer = await customerService.retrieveByEmail(value.email)
|
||||
|
||||
@@ -29,7 +28,4 @@ export default async (req, res) => {
|
||||
await customerService.generateResetPasswordToken(customer.id)
|
||||
|
||||
res.sendStatus(204)
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
try {
|
||||
|
||||
let customer = await customerService.updateAddress(
|
||||
id,
|
||||
address_id,
|
||||
@@ -56,7 +56,4 @@ export default async (req, res) => {
|
||||
})
|
||||
|
||||
res.json({ customer })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { optional } from "joi"
|
||||
import { Validator, MedusaError } from "medusa-core-utils"
|
||||
import { defaultRelations, defaultFields } from "./"
|
||||
|
||||
@@ -64,7 +63,6 @@ export default async (req, res) => {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
await customerService.update(id, value)
|
||||
|
||||
@@ -74,7 +72,4 @@ export default async (req, res) => {
|
||||
})
|
||||
|
||||
res.status(200).json({ customer })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user