fix(ui): Don't display failed fetches in browser

This commit is contained in:
Luke committed 2021-12-28 00:42:45 +01:00
1 parent 5eaed9f87b
commit 49bf5bb3ce
1 file changed
+4
+4
View File
@@ -5,6 +5,8 @@
* @return returnData - A promise for the data sent back by the NuiCallbacks CB argument * @return returnData - A promise for the data sent back by the NuiCallbacks CB argument
*/ */
import { isEnvBrowser } from "./misc";
export async function fetchNui<T = any>( export async function fetchNui<T = any>(
eventName: string, eventName: string,
data: unknown = {} data: unknown = {}
@@ -17,6 +19,8 @@ export async function fetchNui<T = any>(
body: JSON.stringify(data), body: JSON.stringify(data),
}; };
if (isEnvBrowser()) return undefined as any;
const resourceName = (window as any).GetParentResourceName const resourceName = (window as any).GetParentResourceName
? (window as any).GetParentResourceName() ? (window as any).GetParentResourceName()
: "nui-frame-app"; : "nui-frame-app";