project_mern_memories icon indicating copy to clipboard operation
project_mern_memories copied to clipboard

Updated index.js file with configureStore()

Open AAdewunmi opened this issue 1 year ago • 1 comments

Hi, thought I'd contribute this project by refactoring client/scr/index.js to use configureStore() method instead of createStore() method.

AAdewunmi avatar Dec 25 '23 11:12 AAdewunmi

I've added another change without creating a separate branch. Change based on the following error: TypeError: PostMessage.findByIdAndRemove is not a function Fix: Update findByIdAndRemove(id) with findByIdAndDelete(id) Location: server/controllers/post.js - deletePost() Code Snippet:

export const deletePost = async (req, res) => {
  const { id } = req.params;
  if (!mongoose.Types.ObjectId.isValid(id))
    return res.status(404).send(`No post with id: ${id}`);
  await PostMessage.findByIdAndDelete(id); **<== Fix ===>** 
  res.json({ message: "Post deleted successfully." });
}

AAdewunmi avatar Jan 07 '24 15:01 AAdewunmi