mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-02 14:38:46 +00:00
23 lines
764 B
TypeScript
23 lines
764 B
TypeScript
import { useSetRecoilState } from 'recoil';
|
|
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();
|
|
const setNotes = useSetRecoilState(noteStates.noteItems);
|
|
const { t } = useTranslation();
|
|
|
|
const handleAddAlert = ({ message, type }: IAlert) => {
|
|
addAlert({
|
|
message: t(`APPS_${message}`),
|
|
type,
|
|
});
|
|
};
|
|
|
|
useNuiEvent('NOTES', NotesEvents.SEND_NOTE, setNotes);
|
|
useNuiEvent('NOTES', NotesEvents.SEND_ALERT, handleAddAlert);
|
|
};
|