refactor(callback/client): require source in response handler

This commit is contained in:
Linden
2025-03-18 02:39:41 +11:00
parent 6fcb83101f
commit 8509867abd
2 changed files with 4 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ local cbEvent = '__ox_cb_%s'
local callbackTimeout = GetConvarInt('ox:callbackTimeout', 300000)
RegisterNetEvent(cbEvent:format(cache.resource), function(key, ...)
if source == '' then return end
local cb = pendingCallbacks[key]
if not cb then return end

View File

@@ -4,6 +4,8 @@ const pendingCallbacks: Record<string, (...args: any[]) => void> = {};
const callbackTimeout = GetConvarInt('ox:callbackTimeout', 300000);
onNet(`__ox_cb_${cache.resource}`, (key: string, ...args: any) => {
if (!source) return;
const resolve = pendingCallbacks[key];
if (!resolve) return;