diff options
author | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2023-05-02 22:11:31 -0400 |
---|---|---|
committer | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2023-05-02 22:12:29 -0400 |
commit | c02f5c6f75a6420cb0a901f1463ed8ebf89e4268 (patch) | |
tree | 5f31361b186700514833ace6ed0e9b8026a1a1b3 /part2/phonebook/src/services | |
parent | 3469bae0c3c9f68aba48585c1aa92d5781b9bd58 (diff) |
ex2.14 add option to delete selected contact. Input validation could be
added
Diffstat (limited to 'part2/phonebook/src/services')
-rw-r--r-- | part2/phonebook/src/services/persons.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/part2/phonebook/src/services/persons.js b/part2/phonebook/src/services/persons.js index d65f4a3..1da7de4 100644 --- a/part2/phonebook/src/services/persons.js +++ b/part2/phonebook/src/services/persons.js @@ -13,4 +13,8 @@ const update = (id, changedPerson) => { return axios.put(`${baseUrl}/${id}`, changedPerson) } -export default { getAll, create, update } +const remove = (id) => { + return axios.delete(`${baseUrl}/${id}`) +} + +export default { getAll, create, update, remove } |