diff --git a/phone/src/apps/contacts/components/views/ContactInfo.tsx b/phone/src/apps/contacts/components/views/ContactInfo.tsx index c4cfb95..bf147cf 100644 --- a/phone/src/apps/contacts/components/views/ContactInfo.tsx +++ b/phone/src/apps/contacts/components/views/ContactInfo.tsx @@ -91,11 +91,12 @@ const ContactsInfoPage = () => { data: contact, level: 2, }); - Nui.send('phone:addContact', { - name, + Nui.send('phone:addContacts', { + display: name, number, avatar, }); + history.goBack() }; const handleContactSave = () => { @@ -110,6 +111,7 @@ const ContactsInfoPage = () => { number, avatar, }); + history.goBack() }; const handleContactDelete = () => { @@ -121,6 +123,7 @@ const ContactsInfoPage = () => { Nui.send('phone:deleteContact', { id: contact.id, }); + history.goBack() }; return ( diff --git a/phone/src/apps/contacts/components/views/ContactsPage.tsx b/phone/src/apps/contacts/components/views/ContactsPage.tsx index 0694239..b43359d 100644 --- a/phone/src/apps/contacts/components/views/ContactsPage.tsx +++ b/phone/src/apps/contacts/components/views/ContactsPage.tsx @@ -26,7 +26,7 @@ export const ContactPage = () => { <> history.push('/contacts/add')} + onClick={() => history.push('/contacts/-1')} style={{ backgroundColor: '#2196f3', color: '#fff' }} className={classes.absolute} > diff --git a/resources/client/cl_contacts.ts b/resources/client/cl_contacts.ts index 3f1cbe0..0fc8c42 100644 --- a/resources/client/cl_contacts.ts +++ b/resources/client/cl_contacts.ts @@ -12,10 +12,7 @@ onNet(events.CONTACTS_SEND_CONTACTS, (contacts: any) => { RegisterNuiCallbackType(events.CONTACTS_ADD_CONTACT); on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any, cb: Function) => { - const display = data.name; - const number = data.number; - const avatar = data.avatar; - emitNet(events.CONTACTS_ADD_CONTACT, number, display, avatar); + emitNet(events.CONTACTS_ADD_CONTACT, data.number, data.display, data.avatar); cb(); }); @@ -31,7 +28,6 @@ on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any, cb: Function) => { onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => { emitNet(events.CONTACTS_GET_CONTACTS); - console.log('did you update the contact??????????????????'); }); RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT); diff --git a/resources/utils/events.ts b/resources/utils/events.ts index 6cdc6fa..97dbb07 100644 --- a/resources/utils/events.ts +++ b/resources/utils/events.ts @@ -31,7 +31,7 @@ export default { CONTACTS_SEND_CONTACTS: 'phone:sendContacts', CONTACTS_GET_CONTACTS: 'phone:getContacts', CONTACTS_ADD_CONTACT_NUI: 'contacts:add', - CONTACTS_ADD_CONTACT: 'contacts:add', + CONTACTS_ADD_CONTACT: 'phone:addContacts', CONTACTS_ADD_CONTACT_SUCCESS: 'contacts:addSuccess', CONTACTS_UPDATE_CONTACT: 'phone:updateContact', CONTACTS_DELETE_CONTACT: 'phone:deleteContact',