mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(notes/nui): useAlet hook
This commit is contained in:
1 parent
fc1f6b3ad3
commit
59973fcf9e
4 files changed
+31
-1
No files matched your search
@@ -13,4 +13,8 @@ export const noteStates = {
|
||||
key: 'noteDetail',
|
||||
default: null,
|
||||
}),
|
||||
alert: atom({
|
||||
key: 'notesAlert',
|
||||
default: null
|
||||
})
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { INotesAlert } from '../../../common/typings/notes';
|
||||
import { noteStates } from './state';
|
||||
|
||||
export const useNotesAlert = (): INotesAlert => {
|
||||
const [alert, setAlert] = useRecoilState(noteStates.alert)
|
||||
return { alert, setAlert }
|
||||
}
|
||||
@@ -2,9 +2,12 @@ import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { useNotes } from './useNotes';
|
||||
import { noteStates } from './state';
|
||||
import { useNotesAlert } from './useNoteAlert';
|
||||
|
||||
export const useNotesService = () => {
|
||||
const setNotes = useSetRecoilState(noteStates.noteItems);
|
||||
const setAlert = useSetRecoilState(noteStates.alert);
|
||||
useNuiEvent('NOTES', 'setNotes', setNotes);
|
||||
return useNotes();
|
||||
useNuiEvent('NOTES', 'setAlert', setAlert)
|
||||
return { useNotes, useNotesAlert };
|
||||
};
|
||||
Reference in new issue
Block a user