Added getSpellsFromUser() method

This commit is contained in:
Alexis
2021-01-01 22:07:22 +01:00
parent 1759f71876
commit b313393af6
5 changed files with 60 additions and 12 deletions

View File

@@ -60,6 +60,29 @@ router.get('/:uuid/', async (req, res) => {
})
})
// GET SPELLS FROM ONE ------------------
const getSpellsFromUser = (uuid) => {
return Users.getSpellsFromOne(uuid)
.catch(err => {
throw err
})
}
router.get('/:uuid/spells', async (req, res) => {
getSpellsFromUser(req.params.uuid)
.then(v => {
res.setHeader('Content-Type', 'application/json;charset=utf-8')
res.end(JSON.stringify(v))
})
.catch(err => {
res.status(err.code).send(JSON.stringify(
{
"error": err.message,
"code": err.code
})
)
})
})
// CHECK IF MAIL IS AVAILABLE ------------------
const checkIfEmailAvailable = (mail) => {