diff --git a/ui/src/utils/fetchNui.ts b/ui/src/utils/fetchNui.ts index 6069465..63da85b 100644 --- a/ui/src/utils/fetchNui.ts +++ b/ui/src/utils/fetchNui.ts @@ -9,6 +9,8 @@ * @return returnData - A promise for the data sent back by the NuiCallbacks CB argument */ +import { isEnvBrowser } from "./misc"; + export async function fetchNui(eventName: string, data?: any): Promise { const options = { method: 'post', @@ -18,6 +20,8 @@ export async function fetchNui(eventName: string, data?: any): Promise< body: JSON.stringify(data), }; + if (isEnvBrowser()) return undefined as any; + const resourceName = (window as any).GetParentResourceName ? (window as any).GetParentResourceName() : 'nui-frame-app'; const resp = await fetch(`https://${resourceName}/${eventName}`, options);