Files
new-phone-who-dis/resources/client/cl_sellout.ts
T
Taso 0f61088999 refactor(events): Events are now tied to a common enum typings (#167)
* chore(scripts/twitter): Refactored twitter to use event enums

* chore(scripts/marketplace): Refactored marketplace to use event enums

* chore(scripts/messages): Refactored messages to use event enums

* chore(scripts/contacts): Refactored contacts to use event enums

* chore(scripts/calls): Refactored calls to use event enums

* chore(scripts/notes): Refactored notes to use event enums

* chore(scripts/photos): Refactored photos to use event enums

* chore(scripts/bank): Refactored bank to use event enums

* chore(scripts/phone): Refactored phone to use event enums

* chore(events): Removed old events object

* refactor(phone/nui-events): Attached NUI events to respective enum

* tweak(event-enums): Added npwd prefix to all events

* tweak(phone/serve): Added craco to override CRA without eject

Also bumped react-scripts to 4.0.1, with seemingly no issues

* fix(typings/twitter): Fixed method enums for twitter
2021-03-22 13:37:07 -04:00

39 lines
1.3 KiB
TypeScript

import { MarketplaceEvents, MarketplaceListing } from '../../typings/marketplace';
import { IAlertProps } from '../../typings/alerts';
import { sendMarketplaceEvent } from '../utils/messages';
RegisterNuiCallbackType(MarketplaceEvents.ADD_LISTING);
onNet(MarketplaceEvents.SEND_LISTING, (listing: MarketplaceListing) => {
sendMarketplaceEvent('setListing', listing);
});
on(`__cfx_nui:${MarketplaceEvents.ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.ADD_LISTING, data);
cb();
});
RegisterNuiCallbackType(MarketplaceEvents.DELETE_LISTING);
on(`__cfx_nui:${MarketplaceEvents.DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.DELETE_LISTING, data.id);
cb();
});
RegisterNuiCallbackType(MarketplaceEvents.REPORT_LISTING);
on(`__cfx_nui:${MarketplaceEvents.REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.REPORT_LISTING, data);
cb();
});
onNet(MarketplaceEvents.ADD_LISTING_SUCCESS, () => {
emitNet(MarketplaceEvents.FETCH_LISTING);
});
onNet(MarketplaceEvents.DELETE_LISTING_SUCCESS, () => {
emitNet(MarketplaceEvents.FETCH_LISTING);
});
onNet(MarketplaceEvents.ACTION_RESULT, (alert: IAlertProps) => {
sendMarketplaceEvent('setAlert', alert);
});