Skip to content

Commit

Permalink
returning username (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: Luděk Nový <[email protected]>
  • Loading branch information
ludeknovy and Luděk Nový authored Mar 6, 2020
1 parent dae020e commit 1bfab03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/controllers/auth/login-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export const loginController = async (req: Request, res: Response, next: NextFun
return next(boom.unauthorized('The credentials you provided is incorrect'));
}
const token = generateToken(result[0].id);
return res.status(200).send({ token });
return res.status(200).send({ token, username });
} catch (error) {
return next(error)
return next(error);
}

};
Expand All @@ -34,4 +34,4 @@ export const generateToken = (id) => {
config.jwtToken, { expiresIn: '7d' }
);
return token;
}
};

0 comments on commit 1bfab03

Please sign in to comment.