tweak(contacts): Misc changes to contact handling

This commit is contained in:
Taso committed 2021-06-08 15:35:12 -04:00
1 parent d036243d64
commit be8e9bfa39
4 files changed
+5 -7

No files matched your search

@@ -101,7 +101,7 @@ const ContactsInfoPage = () => {
addContact(serverResp.data);
addAlert({
message: t('APPS_CONTACT_ADD_SUCCESS'),
type: 'error',
type: 'success',
});
history.replace(referal);
});
@@ -54,8 +54,7 @@ export const useContactActions = (): UseContactsValue => {
const deleteContact = useCallback(
(id: number): void => {
const contactIndex = contacts.findIndex((contact) => contact.id === id);
const newContacts = [...contacts].slice(contactIndex);
const newContacts = [...contacts].filter((contact) => contact.id !== id);
setContacts(newContacts);
},
[contacts, setContacts],