From 344eb97b613fd51c124a82d2fd6d6d4947fe3da8 Mon Sep 17 00:00:00 2001 From: Shreyashish Sengupta Date: Fri, 18 Aug 2017 15:56:51 +0530 Subject: [PATCH 1/2] Update removeContact --- src/App.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index 6c4a97c..2419bdf 100644 --- a/src/App.js +++ b/src/App.js @@ -14,11 +14,11 @@ class App extends Component { }) } removeContact = (contact) => { - this.setState((state) => ({ - contacts: state.contacts.filter((c) => c.id !== contact.id) - })) - - ContactsAPI.remove(contact) + ContactsAPI.create(contact).then(contact => { + this.setState(state => ({ + contacts: state.contacts.concat([contact]) + })) + }) } createContact(contact) { From bf263b5dd7b185d50481a6505ad4ada3466b8196 Mon Sep 17 00:00:00 2001 From: Shreyashish Sengupta Date: Tue, 12 Sep 2017 09:48:06 +0530 Subject: [PATCH 2/2] Update App.js --- src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 2419bdf..5322b17 100644 --- a/src/App.js +++ b/src/App.js @@ -14,7 +14,7 @@ class App extends Component { }) } removeContact = (contact) => { - ContactsAPI.create(contact).then(contact => { + ContactsAPI.remove(contact).then(contact => { this.setState(state => ({ contacts: state.contacts.concat([contact]) }))