fix(contacts/client|server): fixed source for updating contacts

This commit is contained in:
Christopher committed 2021-01-17 20:12:15 +01:00
1 parent 1913dd48df
commit 59ad36c7fd
3 files changed
+31 -16

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any) => {
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS);
console.log("did you update the contact??????????????????");
});
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
+25 -6
View File
@@ -85,31 +85,50 @@ onNet(
emitNet(events.CONTACTS_ADD_CONTACT_SUCCESS, _source);
emitNet(
events.CONTACTS_ACTION_RESULT,
getSource(),
'CONTACT_ADD_SUCCESS'
_source,
"CONTACT_ADD_SUCCESS"
);
} catch (error) {
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_FAILED');
const _source = (global as any).source;
emitNet(events.CONTACTS_ACTION_RESULT, _source, "CONTACT_ADD_FAILED");
}
}
);
onNet(events.CONTACTS_UPDATE_CONTACT, async (contact: Contacts) => {
console.log('let me just log the contact first', contact);
try {
const _source = (global as any)._source;
const _identifier = await useIdentifier();
updateContact(contact, _identifier);
const _source = (global as any).source;
const _identifier = ESX.GetPlayerFromId(_source).getIdentifier();
console.log('nice identifier bro', _identifier);
await updateContact(contact, _identifier);
console.log('i updated the contact server side!');
emitNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, _source);
console.log('ffs, didd it return successful');
emitNet(
events.CONTACTS_ACTION_RESULT,
<<<<<<< HEAD
getSource(),
'CONTACT_UPDATE_SUCCESS'
=======
_source,
"CONTACT_UPDATE_SUCCESS"
>>>>>>> 76aee07 (fix(contacts/client|server): fixed source for updating contacts)
);
console.log("UPDATED CONTACT: ", contact);
} catch (error) {
const _source = (global as any).source;
emitNet(
events.CONTACTS_ACTION_RESULT,
<<<<<<< HEAD
getSource(),
'CONTACT_UPDATE_FAILED'
=======
_source,
"CONTACT_UPDATE_FAILED"
>>>>>>> 76aee07 (fix(contacts/client|server): fixed source for updating contacts)
);
}
});