Feat(Call): useCall hook

This commit is contained in:
chip committed 2020-09-19 01:19:03 +02:00
1 parent efbdff0849
commit fd09a2df14
11 files changed
+117 -72

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import React from "react";
import { makeStyles } from "@material-ui/core";
import { AppWrapper } from "../../ui/components/AppWrapper";
import { AppTitle } from "../../ui/components/AppTitle";
import { AppContent } from "../../ui/components/AppContent";
import { Button } from "../../ui/components/Button";
export const CallModal = () => {
return (
<AppWrapper>
<AppTitle app="Call" />
<AppContent>
<h1
style={{
display: "flex",
justifyContent: "center",
}}
>
Call
</h1>
</AppContent>
</AppWrapper>
);
};
+8
View File
@@ -0,0 +1,8 @@
import { atom } from "recoil";
export const callerState = {
caller: atom({
key: "callerList",
default: [],
}),
};
+7
View File
@@ -0,0 +1,7 @@
import { useRecoilValue } from "recoil";
import { callerState } from "./state";
export const useCall = () => {
const caller = useRecoilState(callerState.caller);
return { caller };
};
+10
View File
@@ -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();
};