From 5ce6cf2d4afbc19d0b7fd1196a2c5ab49ab12a3f Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 25 Mar 2021 12:53:18 +0100 Subject: [PATCH] update notes enums --- phone/src/apps/notes/hooks/useNotesService.ts | 5 +++-- resources/client/cl_notes.ts | 4 ++-- typings/notes.ts | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/phone/src/apps/notes/hooks/useNotesService.ts b/phone/src/apps/notes/hooks/useNotesService.ts index 79220b8..304dbb8 100644 --- a/phone/src/apps/notes/hooks/useNotesService.ts +++ b/phone/src/apps/notes/hooks/useNotesService.ts @@ -3,6 +3,7 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent'; import { noteStates } from './state'; import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar'; import { useTranslation } from 'react-i18next'; +import { NotesEvents } from '../../../../../typings/notes'; export const useNotesService = () => { const { addAlert } = useSnackbar(); @@ -16,6 +17,6 @@ export const useNotesService = () => { }); }; - useNuiEvent('NOTES', 'setNotes', setNotes); - useNuiEvent('NOTES', 'setAlert', handleAddAlert); + useNuiEvent('NOTES', NotesEvents.SEND_NOTE, setNotes); + useNuiEvent('NOTES', NotesEvents.SEND_ALERT, handleAddAlert); }; diff --git a/resources/client/cl_notes.ts b/resources/client/cl_notes.ts index 4e07d89..425c9bb 100644 --- a/resources/client/cl_notes.ts +++ b/resources/client/cl_notes.ts @@ -2,7 +2,7 @@ import { NotesEvents } from '../../typings/notes'; import { sendNotesEvent } from '../utils/messages'; onNet(NotesEvents.SEND_NOTE, (notes: any) => { - sendNotesEvent('setNotes', notes); + sendNotesEvent(NotesEvents.SEND_NOTE, notes); }); RegisterNuiCallbackType(NotesEvents.ADD_NOTE); @@ -35,5 +35,5 @@ onNet(NotesEvents.UPDATE_NOTE_SUCCESS, () => { }); onNet(NotesEvents.ACTION_RESULT, (alert: any) => { - sendNotesEvent('setAlert', alert); + sendNotesEvent(NotesEvents.SEND_ALERT, alert); }); diff --git a/typings/notes.ts b/typings/notes.ts index 7f718d8..33373dd 100644 --- a/typings/notes.ts +++ b/typings/notes.ts @@ -32,4 +32,5 @@ export enum NotesEvents { UPDATE_NOTE_SUCCESS = 'npwd:updateNoteSuccess', UPDATE_NOTE_FAILURE = 'npwd:updateNoteFailure', ACTION_RESULT = 'npwd:notesActionResult', + SEND_ALERT = 'npwd:notesSetAlert', }