mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
feat(notes/nui): new events for checking succesful adding
This commit is contained in:
1 parent
ce951ceecc
commit
b085d6b708
2 files changed
+16
-19
No files matched your search
@@ -1,44 +1,40 @@
|
||||
import events from '../utils/events';
|
||||
import events from "../utils/events";
|
||||
|
||||
onNet(events.NOTE_SEND_NOTE, (notes: any) => {
|
||||
console.log(notes)
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
app: "NOTES",
|
||||
method: "setNotes",
|
||||
data: notes
|
||||
data: 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, note);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
||||
}, 500);
|
||||
})
|
||||
onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
|
||||
on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
|
||||
const noteId = data;
|
||||
emitNet(events.NOTE_DELETE_NOTE, noteId)
|
||||
|
||||
setTimeout(() => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
||||
}, 500);
|
||||
})
|
||||
emitNet(events.NOTE_DELETE_NOTE, noteId);
|
||||
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
});
|
||||
|
||||
// coming soon tm
|
||||
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, note);
|
||||
});
|
||||
|
||||
onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => {
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
||||
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||
});
|
||||
@@ -51,6 +51,7 @@ export default {
|
||||
NOTE_ADD_NOTE: 'phone:addNote',
|
||||
NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
|
||||
NOTE_SEND_NOTE: 'phone:sendNote',
|
||||
NOTE_SEND_NOTE_SUCCESS: 'phone:sendNoteSuccess',
|
||||
NOTE_DELETE_NOTE: 'phone:deleteNote',
|
||||
NOTE_UPDATE_NOTE: 'phone:updateNote',
|
||||
NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
|
||||
|
||||
Reference in new issue
Block a user