update notes enums

This commit is contained in:
Christopher committed 2021-03-25 12:53:18 +01:00
1 parent 2e4d752cd3
commit 5ce6cf2d4a
3 files changed
+6 -4

No files matched your search

@@ -3,6 +3,7 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { noteStates } from './state'; import { noteStates } from './state';
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar'; import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { NotesEvents } from '../../../../../typings/notes';
export const useNotesService = () => { export const useNotesService = () => {
const { addAlert } = useSnackbar(); const { addAlert } = useSnackbar();
@@ -16,6 +17,6 @@ export const useNotesService = () => {
}); });
}; };
useNuiEvent('NOTES', 'setNotes', setNotes); useNuiEvent('NOTES', NotesEvents.SEND_NOTE, setNotes);
useNuiEvent('NOTES', 'setAlert', handleAddAlert); useNuiEvent('NOTES', NotesEvents.SEND_ALERT, handleAddAlert);
}; };
+2 -2
View File
@@ -2,7 +2,7 @@ import { NotesEvents } from '../../typings/notes';
import { sendNotesEvent } from '../utils/messages'; import { sendNotesEvent } from '../utils/messages';
onNet(NotesEvents.SEND_NOTE, (notes: any) => { onNet(NotesEvents.SEND_NOTE, (notes: any) => {
sendNotesEvent('setNotes', notes); sendNotesEvent(NotesEvents.SEND_NOTE, notes);
}); });
RegisterNuiCallbackType(NotesEvents.ADD_NOTE); RegisterNuiCallbackType(NotesEvents.ADD_NOTE);
@@ -35,5 +35,5 @@ onNet(NotesEvents.UPDATE_NOTE_SUCCESS, () => {
}); });
onNet(NotesEvents.ACTION_RESULT, (alert: any) => { onNet(NotesEvents.ACTION_RESULT, (alert: any) => {
sendNotesEvent('setAlert', alert); sendNotesEvent(NotesEvents.SEND_ALERT, alert);
}); });
+1
View File
@@ -32,4 +32,5 @@ export enum NotesEvents {
UPDATE_NOTE_SUCCESS = 'npwd:updateNoteSuccess', UPDATE_NOTE_SUCCESS = 'npwd:updateNoteSuccess',
UPDATE_NOTE_FAILURE = 'npwd:updateNoteFailure', UPDATE_NOTE_FAILURE = 'npwd:updateNoteFailure',
ACTION_RESULT = 'npwd:notesActionResult', ACTION_RESULT = 'npwd:notesActionResult',
SEND_ALERT = 'npwd:notesSetAlert',
} }