feat(contacts/client): update and delete contacts

This commit is contained in:
chip committed 2020-11-01 22:50:33 +01:00
1 parent 37232f514c
commit b1835bbd75
1 file changed
+24 -3
+24 -3
View File
@@ -17,8 +17,29 @@ on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any) => {
const avatar = data.avatar;
emitNet(events.CONTACTS_ADD_CONTACT, number, display, avatar);
setTimeout(() => {
emitNet(events.CONTACTS_GET_CONTACTS)
}, 500)
});
onNet(events.CONTACTS_ADD_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS)
})
RegisterNuiCallbackType(events.CONTACTS_UPDATE_CONTACT);
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any) => {
const contact = data;
emitNet(events.CONTACTS_UPDATE_CONTACT, contact)
})
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS)
})
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any) => {
const contact = data;
emitNet(events.CONTACTS_DELETE_CONTACT, contact)
})
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS)
})