mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Feat(Call): useCall hook
This commit is contained in:
1 parent
efbdff0849
commit
fd09a2df14
11 files changed
+117
-72
No files matched your search
@@ -0,0 +1,8 @@
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const callerState = {
|
||||
caller: atom({
|
||||
key: "callerList",
|
||||
default: [],
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { callerState } from "./state";
|
||||
|
||||
export const useCall = () => {
|
||||
const caller = useRecoilState(callerState.caller);
|
||||
return { caller };
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { useNuiEvent } from "../../os/nui-events/hooks/useNuiEvent";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { callerState } from "./state";
|
||||
import { useCall } from "./useCall";
|
||||
|
||||
export const useCallService = () => {
|
||||
const setCaller = useSetRecoilState(callerState.caller);
|
||||
useNuiEvent("CALL", "setCaller", setCaller);
|
||||
return useCall();
|
||||
};
|
||||
Reference in new issue
Block a user