Skip to content

Commit

Permalink
ex 2.20 finished part2
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-fedorenk0 committed Sep 11, 2022
1 parent 1a779d4 commit e071bec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions part2/phonebook/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@
"name": "Mary Poppendieck",
"number": "39-23-6423122",
"id": 4
},
{
"name": "John Snow",
"number": "1212",
"id": 6
},
{
"name": "john doe",
"number": "12",
"id": 7
}
]
}
10 changes: 10 additions & 0 deletions part2/phonebook/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ const App = () => {
.then(() => {
setPersons(persons.filter(person => person.id !== id))
})
.catch(error => {
setNotification({
text: `Information of ${name} has already been removed from server`,
type: 'error notification'
})
setTimeout(() => {
setNotification(null)
}, 5000)
setPersons(persons.filter(person => person.id !== id))
})
}
}

Expand Down

0 comments on commit e071bec

Please sign in to comment.