diff --git a/phone/src/apps/contacts/hooks/useContactsService.ts b/phone/src/apps/contacts/hooks/useContactsService.ts index bbdff6b..21f5899 100644 --- a/phone/src/apps/contacts/hooks/useContactsService.ts +++ b/phone/src/apps/contacts/hooks/useContactsService.ts @@ -4,6 +4,7 @@ import { contactsState } from './state'; import { useContacts } from './useContacts'; import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar'; import { useTranslation } from 'react-i18next'; +import { ContactEvents } from '../../../../../typings/contact'; export const useContactsService = () => { const setContacts = useSetRecoilState(contactsState.contacts); @@ -17,7 +18,7 @@ export const useContactsService = () => { }); }; - useNuiEvent('CONTACTS', 'setContacts', setContacts); - useNuiEvent('CONTACTS', 'setAlert', handleAddAlert); + useNuiEvent('CONTACTS', ContactEvents.SEND_CONTACTS, setContacts); + useNuiEvent('CONTACTS', ContactEvents.SEND_ALERT, handleAddAlert); return useContacts(); }; diff --git a/resources/client/cl_contacts.ts b/resources/client/cl_contacts.ts index c5ef672..796eb16 100644 --- a/resources/client/cl_contacts.ts +++ b/resources/client/cl_contacts.ts @@ -2,7 +2,7 @@ import { ContactEvents } from '../../typings/contact'; import { sendContactsEvent } from '../utils/messages'; onNet(ContactEvents.SEND_CONTACTS, (contacts: any) => { - sendContactsEvent('setContacts', contacts); + sendContactsEvent(ContactEvents.SEND_CONTACTS, contacts); }); RegisterNuiCallbackType(ContactEvents.ADD_CONTACT); @@ -36,5 +36,5 @@ onNet(ContactEvents.DELETE_CONTACT_SUCCESS, () => { }); onNet(ContactEvents.ACTION_RESULT, (alert: any) => { - sendContactsEvent('setAlert', alert); + sendContactsEvent(ContactEvents.SEND_ALERT, alert); }); diff --git a/typings/contact.ts b/typings/contact.ts index 4a0c0f2..ffbe230 100644 --- a/typings/contact.ts +++ b/typings/contact.ts @@ -28,4 +28,5 @@ export enum ContactEvents { DELETE_CONTACT_SUCCESS = 'npwd:deleteSuccess', UPDATE_CONTACT_SUCCESS = 'npwd:updateContactSuccess', ACTION_RESULT = 'npwd:contactActionResult', + SEND_ALERT = 'npwd:contactSetAlert', }