completed 2.14
This commit is contained in:
parent
0509e60769
commit
7fcd63cc74
4 changed files with 25 additions and 67 deletions
|
|
@ -85,6 +85,24 @@ const App = () => {
|
|||
setSearchString(event.target.value);
|
||||
};
|
||||
|
||||
const handlePersonDeletionFactory = ({ person }) => {
|
||||
return (event) => {
|
||||
personService
|
||||
.deletePerson(person.id)
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
console.log("postimeout");
|
||||
}, 3000);
|
||||
})
|
||||
.then(() => {
|
||||
return personService.getPersons();
|
||||
})
|
||||
.then((response) => {
|
||||
setPersons(response.data);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2>Phonebook</h2>
|
||||
|
|
@ -102,6 +120,7 @@ const App = () => {
|
|||
persons={persons.filter((person) =>
|
||||
person.name.toUpperCase().includes(searchString.toUpperCase())
|
||||
)}
|
||||
deletionHandlerFactory={handlePersonDeletionFactory}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue