mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 22:16:54 +00:00
* chore(scripts/twitter): Refactored twitter to use event enums * chore(scripts/marketplace): Refactored marketplace to use event enums * chore(scripts/messages): Refactored messages to use event enums * chore(scripts/contacts): Refactored contacts to use event enums * chore(scripts/calls): Refactored calls to use event enums * chore(scripts/notes): Refactored notes to use event enums * chore(scripts/photos): Refactored photos to use event enums * chore(scripts/bank): Refactored bank to use event enums * chore(scripts/phone): Refactored phone to use event enums * chore(events): Removed old events object * refactor(phone/nui-events): Attached NUI events to respective enum * tweak(event-enums): Added npwd prefix to all events * tweak(phone/serve): Added craco to override CRA without eject Also bumped react-scripts to 4.0.1, with seemingly no issues * fix(typings/twitter): Fixed method enums for twitter
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { ContactEvents } from '../../typings/contact';
|
|
import { sendContactsEvent } from '../utils/messages';
|
|
|
|
onNet(ContactEvents.SEND_CONTACTS, (contacts: any) => {
|
|
sendContactsEvent('setContacts', contacts);
|
|
});
|
|
|
|
RegisterNuiCallbackType(ContactEvents.ADD_CONTACT);
|
|
on(`__cfx_nui:${ContactEvents.ADD_CONTACT}`, (data: any, cb: Function) => {
|
|
emitNet(ContactEvents.ADD_CONTACT, data.number, data.display, data.avatar);
|
|
cb();
|
|
});
|
|
|
|
onNet(ContactEvents.ADD_CONTACT_SUCCESS, () => {
|
|
emitNet(ContactEvents.GET_CONTACTS);
|
|
});
|
|
|
|
RegisterNuiCallbackType(ContactEvents.UPDATE_CONTACT);
|
|
on(`__cfx_nui:${ContactEvents.UPDATE_CONTACT}`, (data: any, cb: Function) => {
|
|
emitNet(ContactEvents.UPDATE_CONTACT, data);
|
|
cb();
|
|
});
|
|
|
|
onNet(ContactEvents.UPDATE_CONTACT_SUCCESS, () => {
|
|
emitNet(ContactEvents.GET_CONTACTS);
|
|
});
|
|
|
|
RegisterNuiCallbackType(ContactEvents.DELETE_CONTACT);
|
|
on(`__cfx_nui:${ContactEvents.DELETE_CONTACT}`, (data: any, cb: Function) => {
|
|
emitNet(ContactEvents.DELETE_CONTACT, data);
|
|
cb();
|
|
});
|
|
|
|
onNet(ContactEvents.DELETE_CONTACT_SUCCESS, () => {
|
|
emitNet(ContactEvents.GET_CONTACTS);
|
|
});
|
|
|
|
onNet(ContactEvents.ACTION_RESULT, (alert: any) => {
|
|
sendContactsEvent('setAlert', alert);
|
|
});
|