Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
taugk committed Dec 15, 2023
1 parent 9b0ad36 commit 2999bfa
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions routes/postsRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,17 +484,6 @@ router.put(
ImgUpload.uploadToGcs,
ImgUpload.handleUpload,
async (req, res) => {
const {
title,
description,
price,
pickupTime,
lat,
lon,
freshness,
categoryId,
isAvailable,
} = req.body;
const postId = req.params.id;
try {
const post = await Post.findByPk(postId);
Expand All @@ -515,7 +504,6 @@ router.put(
});
}

// Ensure that pickupTime is defined in the request body
const {
title,
description,
Expand Down Expand Up @@ -559,6 +547,10 @@ router.put(
res.status(200).json({ message: "Post updated successfully", post });
} catch (error) {
console.error("Error updating post", error);
const token =
req.headers["authorization"] &&
req.headers["authorization"].split(" ")[1];

if (invalidatedTokens && invalidatedTokens.has(token)) {
return res
.status(401)
Expand Down

0 comments on commit 2999bfa

Please sign in to comment.