From c02f5c6f75a6420cb0a901f1463ed8ebf89e4268 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Tue, 2 May 2023 22:11:31 -0400 Subject: ex2.14 add option to delete selected contact. Input validation could be added --- part2/phonebook/src/services/persons.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'part2/phonebook/src/services') 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 } -- cgit v1.2.3