fix: make packages/medusa/src/api/routes/admin/users pass eslint
This commit is contained in:
1 parent
71561b0a61
commit
a6a612c941
8 files changed
+1
-28
No files matched your search
@@ -43,7 +43,6 @@
|
|||||||
/packages/medusa/src/api/routes/admin/shipping-profiles
|
/packages/medusa/src/api/routes/admin/shipping-profiles
|
||||||
/packages/medusa/src/api/routes/admin/store
|
/packages/medusa/src/api/routes/admin/store
|
||||||
/packages/medusa/src/api/routes/admin/swaps
|
/packages/medusa/src/api/routes/admin/swaps
|
||||||
/packages/medusa/src/api/routes/admin/users
|
|
||||||
|
|
||||||
|
|
||||||
/packages/medusa/src/api/routes/store/auth
|
/packages/medusa/src/api/routes/store/auth
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"endOfLine": "lf",
|
"endOfLine": "auto",
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"singleQuote": false,
|
"singleQuote": false,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
|
|||||||
@@ -13,14 +13,10 @@ 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 userService = req.scope.resolve("userService")
|
const userService = req.scope.resolve("userService")
|
||||||
const data = _.pick(value, ["email", "name"])
|
const data = _.pick(value, ["email", "name"])
|
||||||
|
|
||||||
const user = await userService.create(data, value.password)
|
const user = await userService.create(data, value.password)
|
||||||
|
|
||||||
res.status(200).json({ user })
|
res.status(200).json({ user })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
const { user_id } = req.params
|
const { user_id } = req.params
|
||||||
|
|
||||||
try {
|
|
||||||
const userService = req.scope.resolve("userService")
|
const userService = req.scope.resolve("userService")
|
||||||
|
|
||||||
const user = await userService.retrieve(user_id)
|
const user = await userService.retrieve(user_id)
|
||||||
res.json({ user })
|
res.json({ user })
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
try {
|
|
||||||
const userService = req.scope.resolve("userService")
|
const userService = req.scope.resolve("userService")
|
||||||
const users = await userService.list({})
|
const users = await userService.list({})
|
||||||
|
|
||||||
res.status(200).json({ users })
|
res.status(200).json({ users })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,6 @@ export default async (req, res) => {
|
|||||||
if (error) {
|
if (error) {
|
||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const userService = req.scope.resolve("userService")
|
const userService = req.scope.resolve("userService")
|
||||||
const user = await userService.retrieveByEmail(value.email)
|
const user = await userService.retrieveByEmail(value.email)
|
||||||
|
|
||||||
@@ -18,7 +16,4 @@ export default async (req, res) => {
|
|||||||
await userService.generateResetPasswordToken(user.id)
|
await userService.generateResetPasswordToken(user.id)
|
||||||
|
|
||||||
res.sendStatus(204)
|
res.sendStatus(204)
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,6 @@ export default async (req, res) => {
|
|||||||
if (error) {
|
if (error) {
|
||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const userService = req.scope.resolve("userService")
|
const userService = req.scope.resolve("userService")
|
||||||
const user = await userService.retrieveByEmail(value.email)
|
const user = await userService.retrieveByEmail(value.email)
|
||||||
|
|
||||||
@@ -26,7 +24,4 @@ export default async (req, res) => {
|
|||||||
const data = await userService.setPassword(user.id, value.password)
|
const data = await userService.setPassword(user.id, value.password)
|
||||||
|
|
||||||
res.status(200).json({ user: data })
|
res.status(200).json({ user: data })
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -12,11 +12,7 @@ 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 userService = req.scope.resolve("userService")
|
const userService = req.scope.resolve("userService")
|
||||||
const data = await userService.update(user_id, value)
|
const data = await userService.update(user_id, value)
|
||||||
res.status(200).json({ user: data })
|
res.status(200).json({ user: data })
|
||||||
} catch (err) {
|
|
||||||
throw err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user