Skip to content

Commit

Permalink
added update profile
Browse files Browse the repository at this point in the history
  • Loading branch information
yashrajjain726 committed Jul 16, 2023
1 parent 22c270c commit c4022de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Empty file added README.md
Empty file.
13 changes: 13 additions & 0 deletions routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ userRouter.post("/api/user/update-address", auth, async (request, response) => {
}
});

userRouter.post("/api/user/update", auth, async (request, response) => {
try {
const { address, name } = request.body;
let user = await User.findById(request.user);
user.address = address;
user.name = name;
user = await user.save();
response.json(user);
} catch (error) {
response.status(500).json({ error: error.message });
}
});

userRouter.post("/api/user/order-product", auth, async (request, response) => {
try {
const { cart, totalPrice, address } = request.body;
Expand Down
14 changes: 0 additions & 14 deletions vercel.json

This file was deleted.

0 comments on commit c4022de

Please sign in to comment.