mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
refactor(notes): Refactor to new promise event format
This commit is contained in:
1 parent
bb81ab6fe2
commit
44a9595463
16 files changed
+394
-332
No files matched your search
@@ -1,37 +1,7 @@
|
||||
import { Note, NotesEvents } from '../../typings/notes';
|
||||
import { sendNotesEvent } from '../utils/messages';
|
||||
import { NotesEvents } from '../../typings/notes';
|
||||
import { RegisterNuiProxy } from './cl_utils';
|
||||
|
||||
onNet(NotesEvents.SEND_NOTE, (notes: any) => {
|
||||
sendNotesEvent(NotesEvents.SEND_NOTE, notes);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(NotesEvents.ADD_NOTE);
|
||||
on(`__cfx_nui:${NotesEvents.ADD_NOTE}`, (note: Note) => {
|
||||
emitNet(NotesEvents.ADD_NOTE, note);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(NotesEvents.DELETE_NOTE);
|
||||
on(`__cfx_nui:${NotesEvents.DELETE_NOTE}`, (noteId: number) => {
|
||||
emitNet(NotesEvents.DELETE_NOTE, noteId);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(NotesEvents.UPDATE_NOTE);
|
||||
on(`__cfx_nui:${NotesEvents.UPDATE_NOTE}`, (note: Note) => {
|
||||
emitNet(NotesEvents.UPDATE_NOTE, note);
|
||||
});
|
||||
|
||||
onNet(NotesEvents.SEND_NOTE_SUCCESS, () => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
onNet(NotesEvents.UPDATE_NOTE_SUCCESS, () => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
onNet(NotesEvents.ACTION_RESULT, (alert: any) => {
|
||||
sendNotesEvent(NotesEvents.SEND_ALERT, alert);
|
||||
});
|
||||
|
||||
onNet(NotesEvents.DELETE_NOTE_SUCCESS, () => {
|
||||
emitNet(NotesEvents.FETCH_ALL_NOTES);
|
||||
});
|
||||
RegisterNuiProxy(NotesEvents.ADD_NOTE);
|
||||
RegisterNuiProxy(NotesEvents.FETCH_ALL_NOTES);
|
||||
RegisterNuiProxy(NotesEvents.UPDATE_NOTE);
|
||||
RegisterNuiProxy(NotesEvents.DELETE_NOTE);
|
||||
Reference in new issue
Block a user