mirror of
https://github.com/xfarrow/blink
synced 2025-04-13 16:41:59 +02:00
Update person_routes.js
This commit is contained in:
parent
c917358537
commit
38ffe52555
@ -86,13 +86,13 @@ async function login (req, res) {
|
|||||||
const person = await personModel.getPersonByEmailAndPassword(req.body.email, req.body.password);
|
const person = await personModel.getPersonByEmailAndPassword(req.body.email, req.body.password);
|
||||||
if (person) {
|
if (person) {
|
||||||
const token = jwtUtils.generateToken(person.id);
|
const token = jwtUtils.generateToken(person.id);
|
||||||
res.status(200).json({ token });
|
return res.status(200).json({ token });
|
||||||
} else {
|
} else {
|
||||||
res.status(401).json({ error: 'Unauthorized' });
|
return res.status(401).json({ error: 'Unauthorized' });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error in function ${login.name}: ${error}`);
|
console.error(`Error in function ${login.name}: ${error}`);
|
||||||
res.status(500).json({ error: 'Internal server error' });
|
return res.status(500).json({ error: 'Internal server error' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user