Browse Source

auth: fix profile route

master
Garrit Franke 3 years ago
parent
commit
b20219ebf3
Signed by: garrit
GPG Key ID: 65586C4DDA55EA2C
  1. 4
      server/routes/auth.js
  2. 2
      server/routes/users.js

4
server/routes/auth.js

@ -53,10 +53,10 @@ router.post("/login", async (req, res) => {
router.get("/profile", async (req, res) => {
console.debug("Fetching profile for:", req.userId);
let user = await User.findOne({ _id: req.userId });
let user = await User.query().findById(req.userId);
if (user) {
user.password = undefined;
user.passwordHash = undefined;
return res.json(user);
} else {
const message = "User not found";

2
server/routes/users.js

@ -28,7 +28,7 @@ router.post("/", async (req, res) => {
router.get("/:id", async (req, res) => {
const id = req.params.id;
const result = await User.findById(id);
const result = await User.query.findById(id);
res.send(result);
});

Loading…
Cancel
Save