diff --git a/backend/controllers/auth.controller.js b/backend/controllers/auth.controller.js index 19885a3..b11f73f 100644 --- a/backend/controllers/auth.controller.js +++ b/backend/controllers/auth.controller.js @@ -48,14 +48,11 @@ exports.login = async (req, res) => { const user = await User.findOne({ where: { authId: auth.id - } + }, + include: ['roles'] }); - const authorities = []; - const roles = await user.getRoles(); - for (let i = 0; i < roles.length; i++) { - authorities.push("ROLE_" + roles[i].name.toUpperCase()); - } + const authorities = user.roles.map(role => "ROLE_" + role.name.toUpperCase()); return res.status(200).send({ id: user.id,