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

This commit is contained in:
Christopher committed 2021-01-15 22:07:45 +01:00
1 parent ccb5b76d29
commit 76aee071a8
3 files changed
+22 -13

No files matched your search

+16 -7
View File
@@ -85,30 +85,39 @@ onNet(
emitNet(events.CONTACTS_ADD_CONTACT_SUCCESS, _source);
emitNet(
events.CONTACTS_ACTION_RESULT,
getSource(),
_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,
getSource(),
_source,
"CONTACT_UPDATE_SUCCESS"
);
console.log("UPDATED CONTACT: ", contact);
} catch (error) {
const _source = (global as any).source;
emitNet(
events.CONTACTS_ACTION_RESULT,
getSource(),
_source,
"CONTACT_UPDATE_FAILED"
);
}