token y cambios al reporte
This commit is contained in:
@@ -27,7 +27,6 @@ const escolares = async (body) => {
|
||||
}
|
||||
return Usuario.findOne({
|
||||
where: { numeroCuenta: body.numeroCuenta },
|
||||
// include: [{ model: Carrera }],
|
||||
attributes: [
|
||||
'idUsuario',
|
||||
'numeroCuenta',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const escolares = require('./escolares');
|
||||
const axios = require('axios');
|
||||
const { crearToken } = require('../../middleware/autentificacion');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
const { comparar } = require('../../helper/encriptar');
|
||||
|
||||
const login = async (body) => {
|
||||
const numeroCuenta = validar.validarNumeroCuenta(body.numeroCuenta);
|
||||
@@ -24,6 +24,12 @@ const login = async (body) => {
|
||||
const datos = escolares(info.data);
|
||||
return datos;
|
||||
})
|
||||
.then((res) => ({
|
||||
Usuario: res,
|
||||
token: crearToken({
|
||||
idUsuario: numeroCuenta,
|
||||
}),
|
||||
}))
|
||||
.catch((err) => {
|
||||
throw new Error('Usuario o contraseña incorrecta.');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user