Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated index.js file with configureStore() #179

Open
wants to merge 12 commits into
base: PART_1_and_2
Choose a base branch
from

Conversation

AAdewunmi
Copy link

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

Copy link
Author

@AAdewunmi AAdewunmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor client/scr/index.js to use Redux configureStore() instead of createStore().

@AAdewunmi
Copy link
Author

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." });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants