Skip to content
Snippets Groups Projects
Commit d9c0d460 authored by Renzo Beux's avatar Renzo Beux
Browse files

validate bugfix

parent 3430d61e
No related branches found
No related tags found
No related merge requests found
......@@ -143,12 +143,12 @@ const login = async (req: Request, res: Response): Promise<Response> => {
const validate = async (req: Request, res: Response): Promise<Response> => {
const { token } = req.body;
if (token) {
jwt.verify(token, secret.auth, (error: Error, decoded: {id: number; type: number}) => {
jwt.verify(token, secret.auth, (error: Error, decoded: {user: number; role: number}) => {
if (error) {
const message = 'Invalid token';
return res.status(401).send({ message });
}
const userId = decoded.id;
const userId = decoded.user;
return res.status(200).send({ userId });
});
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment