feat(contacts/nui): alert on actions

This commit is contained in:
Christopher committed 2020-12-11 22:01:16 +01:00
1 parent a415301145
commit da32d2ca35
4 files changed
+45 -28

No files matched your search

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