mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 07:26:02 +01:00
feat(context): prevent event triggering (#34)
This commit is contained in:
@@ -13,19 +13,12 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { Option, ContextMenuProps } from "../../interfaces/context";
|
||||
import { fetchNui } from "../../utils/fetchNui";
|
||||
|
||||
interface DataProps {
|
||||
event?: string;
|
||||
serverEvent?: string;
|
||||
args?: any;
|
||||
}
|
||||
|
||||
const openMenu = (id: string | undefined) => {
|
||||
fetchNui<ContextMenuProps>("openContext", id);
|
||||
};
|
||||
|
||||
const clickContext = (data: DataProps) => {
|
||||
if (!data.event && !data.serverEvent) return;
|
||||
fetchNui("clickContext", data);
|
||||
const clickContext = (id: string) => {
|
||||
fetchNui("clickContext", id);
|
||||
};
|
||||
|
||||
const Item: React.FC<{
|
||||
@@ -58,11 +51,7 @@ const Item: React.FC<{
|
||||
onClick={() =>
|
||||
option[1].menu
|
||||
? openMenu(option[1].menu)
|
||||
: clickContext({
|
||||
event: option[1].event,
|
||||
serverEvent: option[1].serverEvent,
|
||||
args: option[1].args,
|
||||
})
|
||||
: clickContext(option[0])
|
||||
}
|
||||
>
|
||||
<Box>
|
||||
|
||||
Reference in New Issue
Block a user