Skip to content

Commit 0047bec

Browse files
committed
extracted collection and project id from request body instead of params
1 parent ff51920 commit 0047bec

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

backend/Controllers/collection.controller.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ export const saveProject = async (req, res) => {
9393
export const deleteProject = async(req,res)=>{
9494
try{
9595
const userID = req.user;
96-
const collectionID = req.params.cid;
97-
const projectID = req.params.project_id;
96+
const {collectionID,projectID} = req.body;
9897
console.log(userID , projectID, collectionID);
9998
const existingUser = await User.findById(userID);
10099
if(!existingUser) return res.status(404).json("User not found");

backend/Routes/api/collections.routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { authenticateUser } from '../../Middlewares/auth.middleware.js';
44
const collectionRoutes = express.Router();
55
collectionRoutes.post("/create-collection", authenticateUser, createNewCollection);
66
collectionRoutes.post("/:id", authenticateUser, saveProject);
7-
collectionRoutes.delete("/delete/:cid/:project_id", authenticateUser, deleteProject);
7+
collectionRoutes.delete("/saved-projects", authenticateUser, deleteProject);
88

99

1010
export default collectionRoutes;

0 commit comments

Comments
 (0)