From be8e9bfa39dc6430ac3121805f9e10d5fe3adda2 Mon Sep 17 00:00:00 2001 From: Taso Date: Tue, 8 Jun 2021 15:35:12 -0400 Subject: [PATCH] tweak(contacts): Misc changes to contact handling --- config.json | 2 +- phone/src/apps/contacts/components/views/ContactInfo.tsx | 2 +- phone/src/apps/contacts/hooks/useContactActions.ts | 3 +-- resources/server/contacts/contacts.service.ts | 5 ++--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/config.json b/config.json index 18200fe..3faa450 100644 --- a/config.json +++ b/config.json @@ -40,7 +40,7 @@ "showNotifications": true }, "debug": { - "level": "debug", + "level": "silly", "enabled": true } } diff --git a/phone/src/apps/contacts/components/views/ContactInfo.tsx b/phone/src/apps/contacts/components/views/ContactInfo.tsx index cce1ddf..2b30cd0 100644 --- a/phone/src/apps/contacts/components/views/ContactInfo.tsx +++ b/phone/src/apps/contacts/components/views/ContactInfo.tsx @@ -101,7 +101,7 @@ const ContactsInfoPage = () => { addContact(serverResp.data); addAlert({ message: t('APPS_CONTACT_ADD_SUCCESS'), - type: 'error', + type: 'success', }); history.replace(referal); }); diff --git a/phone/src/apps/contacts/hooks/useContactActions.ts b/phone/src/apps/contacts/hooks/useContactActions.ts index 8b6a974..6d2d8ef 100644 --- a/phone/src/apps/contacts/hooks/useContactActions.ts +++ b/phone/src/apps/contacts/hooks/useContactActions.ts @@ -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], diff --git a/resources/server/contacts/contacts.service.ts b/resources/server/contacts/contacts.service.ts index e91a0bc..a325fe4 100644 --- a/resources/server/contacts/contacts.service.ts +++ b/resources/server/contacts/contacts.service.ts @@ -1,9 +1,8 @@ import PlayerService from '../players/player.service'; import { contactsLogger } from './contacts.utils'; import ContactsDB, { _ContactsDB } from './contacts.db'; -import { Contact, ContactEvents, PreDBContact } from '../../../typings/contact'; -import { FxServerResponse } from '../../../typings/phone'; -import { ContactServerResp } from './contacts.interfaces'; +import { Contact, ContactDeleteDTO, PreDBContact } from '../../../typings/contact'; +import { PromiseEventResp, PromiseRequest } from '../utils/PromiseNetEvents/promise.types'; class _ContactService { private readonly contactsDB: _ContactsDB;