error case: creating user with duplicate email, return json with msg for toast

This commit is contained in:
Dave Horton
2022-12-26 13:19:24 -06:00
parent 5a9e22df5e
commit e42634d726
+1 -1
View File
@@ -370,7 +370,7 @@ router.post('/', async(req, res) => {
const email = allUsers.find((e) => e.email === payload.email);
if (email) {
logger.debug({payload}, 'user with this email already exists');
return res.sendStatus(403);
res.status(422).json({msg: 'user with this email already exists'});
}
if (decodedJwt.scope === 'admin') {