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
This commit is contained in:
Taso authored and GitHub committed 2021-03-22 13:37:07 -04:00
1 parent 53d5bb459d
commit 0f61088999
62 files changed
+4734 -3470

No files matched your search

+17 -17
View File
@@ -1,38 +1,38 @@
import events from '../utils/events';
import { MarketplaceListing } from '../../typings/marketplace';
import { MarketplaceEvents, MarketplaceListing } from '../../typings/marketplace';
import { IAlertProps } from '../../typings/alerts';
import { sendMarketplaceEvent } from '../utils/messages';
onNet(events.SELLOUT_SEND_LISTING, (listing: MarketplaceListing) => {
RegisterNuiCallbackType(MarketplaceEvents.ADD_LISTING);
onNet(MarketplaceEvents.SEND_LISTING, (listing: MarketplaceListing) => {
sendMarketplaceEvent('setListing', listing);
});
RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING);
on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(events.SELLOUT_ADD_LISTING, data);
on(`__cfx_nui:${MarketplaceEvents.ADD_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.ADD_LISTING, data);
cb();
});
RegisterNuiCallbackType(events.SELLOUT_DELETE_LISTING);
on(`__cfx_nui:${events.SELLOUT_DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(events.SELLOUT_DELETE_LISTING, data.id);
RegisterNuiCallbackType(MarketplaceEvents.DELETE_LISTING);
on(`__cfx_nui:${MarketplaceEvents.DELETE_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.DELETE_LISTING, data.id);
cb();
});
RegisterNuiCallbackType(events.SELLOUT_REPORT_LISTING);
on(`__cfx_nui:${events.SELLOUT_REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(events.SELLOUT_REPORT_LISTING, data);
RegisterNuiCallbackType(MarketplaceEvents.REPORT_LISTING);
on(`__cfx_nui:${MarketplaceEvents.REPORT_LISTING}`, (data: MarketplaceListing, cb: Function) => {
emitNet(MarketplaceEvents.REPORT_LISTING, data);
cb();
});
onNet(events.SELLOUT_ADD_LISTING_SUCCESS, () => {
emitNet(events.SELLOUT_FETCH_LISTING);
onNet(MarketplaceEvents.ADD_LISTING_SUCCESS, () => {
emitNet(MarketplaceEvents.FETCH_LISTING);
});
onNet(events.SELLOUT_DELETE_LISTING_SUCCESS, () => {
emitNet(events.SELLOUT_FETCH_LISTING);
onNet(MarketplaceEvents.DELETE_LISTING_SUCCESS, () => {
emitNet(MarketplaceEvents.FETCH_LISTING);
});
onNet(events.SELLOUT_ACTION_RESULT, (alert: IAlertProps) => {
onNet(MarketplaceEvents.ACTION_RESULT, (alert: IAlertProps) => {
sendMarketplaceEvent('setAlert', alert);
});