Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaFrncJrg committed Feb 10, 2025
1 parent 3fd3614 commit d76cdec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/xo-server/src/xo-mixins/rest-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,9 +1519,12 @@ export default class RestApi {
'/:collection(users)',
json(),
wrap(async (req, res) => {
const { email, password, permission } = req.body
const id = await app.createUser({ email, password, permission })
res.sendStatus(204)
const { name, password, permission } = req.body
if (!name || !password) {
return res.status(400).json({ message: 'Name and password are required.' })
}
const user = await app.createUser({ name, password, permission })
res.status(201).end(user.id)
})
)
}
Expand Down

0 comments on commit d76cdec

Please sign in to comment.