From 49bf5bb3cecc5a6f2fea9909c7d8db6f46f9a7ad Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 28 Dec 2021 00:42:45 +0100 Subject: [PATCH] fix(ui): Don't display failed fetches in browser --- ui/src/utils/fetchNui.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/src/utils/fetchNui.ts b/ui/src/utils/fetchNui.ts index 95c2794..02c60d1 100644 --- a/ui/src/utils/fetchNui.ts +++ b/ui/src/utils/fetchNui.ts @@ -5,6 +5,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: unknown = {} @@ -17,6 +19,8 @@ export async function fetchNui( body: JSON.stringify(data), }; + if (isEnvBrowser()) return undefined as any; + const resourceName = (window as any).GetParentResourceName ? (window as any).GetParentResourceName() : "nui-frame-app";