front and back work

This commit is contained in:
QkoSad
2023-07-29 18:29:41 +03:00
parent 40051f9d5e
commit 2fee49e583
9 changed files with 29 additions and 26 deletions
+2 -1
View File
@@ -14,9 +14,10 @@ const router = express.Router();
// @route GET api/auth
// @desc Get user by token
// @access Private
router.get("/", auth, async (req: Request, res) => {
router.get("/", auth, async (req: any, res) => {
try {
let user: unknown = null
console.log(req.user)
if (isUserId(req)) {
user = await User.findById(req.user.id).select("-password");
res.json(user);