mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +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) => {
|
onNet(events.NOTE_SEND_NOTE, (notes: any) => {
|
||||||
console.log(notes)
|
|
||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: "NOTES",
|
app: "NOTES",
|
||||||
method: "setNotes",
|
method: "setNotes",
|
||||||
data: notes
|
data: notes,
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
RegisterNuiCallbackType(events.NOTE_ADD_NOTE);
|
RegisterNuiCallbackType(events.NOTE_ADD_NOTE);
|
||||||
on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => {
|
on(`__cfx_nui:${events.NOTE_ADD_NOTE}`, (data: any) => {
|
||||||
const note = data;
|
const note = data;
|
||||||
emitNet(events.NOTE_ADD_NOTE, note)
|
emitNet(events.NOTE_ADD_NOTE, note);
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
onNet(events.NOTE_SEND_NOTE_SUCCESS, () => {
|
||||||
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||||
}, 500);
|
});
|
||||||
})
|
|
||||||
|
|
||||||
RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
|
RegisterNuiCallbackType(events.NOTE_DELETE_NOTE);
|
||||||
on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
|
on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
|
||||||
const noteId = data;
|
const noteId = data;
|
||||||
emitNet(events.NOTE_DELETE_NOTE, noteId)
|
emitNet(events.NOTE_DELETE_NOTE, noteId);
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
|
||||||
}, 500);
|
|
||||||
})
|
|
||||||
|
|
||||||
|
emitNet(events.NOTE_FETCH_ALL_NOTES);
|
||||||
|
});
|
||||||
|
|
||||||
// coming soon tm
|
// coming soon tm
|
||||||
RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
|
RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
|
||||||
on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
|
on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
|
||||||
const note = data;
|
const note = data;
|
||||||
emitNet(events.NOTE_UPDATE_NOTE, note)
|
emitNet(events.NOTE_UPDATE_NOTE, note);
|
||||||
})
|
});
|
||||||
|
|
||||||
onNet(events.NOTE_UPDATE_NOTE_SUCCESS, () => {
|
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_ADD_NOTE: 'phone:addNote',
|
||||||
NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
|
NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
|
||||||
NOTE_SEND_NOTE: 'phone:sendNote',
|
NOTE_SEND_NOTE: 'phone:sendNote',
|
||||||
|
NOTE_SEND_NOTE_SUCCESS: 'phone:sendNoteSuccess',
|
||||||
NOTE_DELETE_NOTE: 'phone:deleteNote',
|
NOTE_DELETE_NOTE: 'phone:deleteNote',
|
||||||
NOTE_UPDATE_NOTE: 'phone:updateNote',
|
NOTE_UPDATE_NOTE: 'phone:updateNote',
|
||||||
NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
|
NOTE_UPDATE_NOTE_SUCCESS: 'phone:updateNoteSuccess',
|
||||||
|
|||||||
Reference in new issue
Block a user