feat(Alerts): alerts for contacts

This commit is contained in:
Christopher committed 2021-02-18 23:20:24 +01:00
1 parent 11af8bfb5a
commit 9846a4e1ae
4 files changed
+31 -21

No files matched your search

@@ -1,8 +0,0 @@
import { useRecoilState } from 'recoil';
import { IContactAlert } from '../../../common/typings/contact';
import { contactsState } from './state';
export const useContactAlert = (): IContactAlert => {
const [alert, setAlert] = useRecoilState(contactsState.contactAlert);
return { alert, setAlert };
};
@@ -2,12 +2,12 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { useSetRecoilState } from 'recoil';
import { contactsState } from './state';
import { useContacts } from './useContacts';
import { useContactAlert } from './useAlert';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
export const useContactsService = () => {
const setContacts = useSetRecoilState(contactsState.contacts);
const setAlert = useSetRecoilState(contactsState.contactAlert);
const { addAlert } = useSnackbar()
useNuiEvent('CONTACTS', 'setContacts', setContacts);
useNuiEvent('CONTACTS', 'setAlert', setAlert);
return { useContacts, useContactAlert };
};
useNuiEvent('CONTACTS', 'setAlert', addAlert);
return useContacts();
};