feat(notes/client|server): sending alert results!

This commit is contained in:
Christopher committed 2021-02-08 18:54:13 +01:00
1 parent 4d92847163
commit a8f025aff3
5 files changed
+46 -29

No files matched your search

+12 -14
View File
@@ -1,19 +1,13 @@
import events from '../utils/events';
import { sendNotesEvent } from '../utils/messages';
onNet(events.NOTE_SEND_NOTE, (notes: any) => {
SendNuiMessage(
JSON.stringify({
app: 'NOTES',
method: 'setNotes',
data: notes,
})
);
sendNotesEvent('setNotes', notes);
});
RegisterNuiCallbackType(events.NOTE_ADD_NOTE);
on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => {
const note = data;
emitNet(events.NOTE_ADD_NOTE, note);
emitNet(events.NOTE_ADD_NOTE, data);
});
onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
@@ -22,18 +16,22 @@ onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
const noteId = data;
emitNet(events.NOTE_DELETE_NOTE, noteId);
emitNet(events.NOTE_DELETE_NOTE, data);
emitNet(events.NOTE_FETCH_ALL_NOTES);
});
RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
const note = data;
emitNet(events.NOTE_UPDATE_NOTE, note);
emitNet(events.NOTE_UPDATE_NOTE, data);
});
onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => {
emitNet(events.NOTE_FETCH_ALL_NOTES);
});
onNet(events.NOTE_ACTION_RESULT, (type: string) => {
console.log(type)
sendNotesEvent('setAlert', type)
})