Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

updated removeContact method #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Shreyashish
Copy link

Removing the contact only when the backend sends a success in its promise.

src/App.js Outdated
}))

ContactsAPI.remove(contact)
ContactsAPI.create(contact).then(contact => {

Choose a reason for hiding this comment

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

Should it not be remove method ?
ContactsAPI.remove(contact).then( contact => { this.setState(state => ({ contacts: state.contacts.filter(c => c.id !== contact.id) })) })

Copy link
Author

Choose a reason for hiding this comment

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

yes it should.... my bad

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

Successfully merging this pull request may close these issues.

3 participants