mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
refactor(contacts): Refactor contacts to efficient data fetching
This commit is contained in:
1 parent
1940833f56
commit
ecb71cc359
29 files changed
+417
-352
No files matched your search
@@ -1,40 +1,7 @@
|
||||
import { ContactEvents, PreDBContact } from '../../typings/contact';
|
||||
import { sendContactsEvent } from '../utils/messages';
|
||||
import { ContactEvents } from '../../typings/contact';
|
||||
import { RegisterNuiProxy } from './cl_utils';
|
||||
|
||||
onNet(ContactEvents.SEND_CONTACTS, (contacts: any) => {
|
||||
sendContactsEvent(ContactEvents.SEND_CONTACTS, contacts);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(ContactEvents.ADD_CONTACT);
|
||||
on(`__cfx_nui:${ContactEvents.ADD_CONTACT}`, (data: PreDBContact, cb: Function) => {
|
||||
emitNet(ContactEvents.ADD_CONTACT, data);
|
||||
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(ContactEvents.SEND_ALERT, alert);
|
||||
});
|
||||
RegisterNuiProxy(ContactEvents.GET_CONTACTS);
|
||||
RegisterNuiProxy(ContactEvents.ADD_CONTACT);
|
||||
RegisterNuiProxy(ContactEvents.DELETE_CONTACT);
|
||||
RegisterNuiProxy(ContactEvents.UPDATE_CONTACT);
|
||||
@@ -12,7 +12,7 @@ interface ISettingsParams {
|
||||
export default class ClientUtils {
|
||||
private _settings: ISettings;
|
||||
private _defaultSettings: ISettings = {
|
||||
promiseTimeout: 5000,
|
||||
promiseTimeout: 15000,
|
||||
};
|
||||
|
||||
constructor(settings?: ISettingsParams) {
|
||||
|
||||
Reference in new issue
Block a user