mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
refactor(server/source-handling): Altered how we handle source
These changes are made in case source is not guranteed to remain the same Due to how JS should operate, this shouldn't be an issue but this just ensures that
This commit is contained in:
1 parent
acb8e056c3
commit
1aa6a383ab
12 files changed
+222
-140
No files matched your search
@@ -42,24 +42,29 @@ async function addListing(
|
||||
}
|
||||
|
||||
onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const _source = (global as any).source;
|
||||
const listings = await fetchAllListings();
|
||||
emitNet(events.SELLOUT_SEND_LISTING, _source, listings);
|
||||
} catch (e) {
|
||||
selloutLogger.error(`Failed to fetch listings, ${e.message}`);
|
||||
selloutLogger.error(`Failed to fetch listings, ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
|
||||
const _source = getSource();
|
||||
try {
|
||||
const xPlayer = ESX.GetPlayerFromId(getSource());
|
||||
const xPlayer = ESX.GetPlayerFromId(_source);
|
||||
const _identifier = xPlayer.getIdentifier();
|
||||
const name = xPlayer.getName();
|
||||
|
||||
const phoneNumber = await usePhoneNumber(_identifier);
|
||||
addListing(_identifier, name, phoneNumber, listing);
|
||||
await addListing(_identifier, name, phoneNumber, listing);
|
||||
} catch (e) {
|
||||
selloutLogger.error(`Failed to add listing ${e.message}`);
|
||||
selloutLogger.error(`Failed to add listing ${e.message}`, {
|
||||
source: _source,
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user