mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { MarketplaceEvents, MarketplaceListing } from '../../typings/marketplace';
|
|
import { IAlertProps } from '../../typings/alerts';
|
|
import { sendMarketplaceEvent } from '../utils/messages';
|
|
|
|
onNet(MarketplaceEvents.SEND_LISTING, (listings: MarketplaceListing[]) => {
|
|
sendMarketplaceEvent('setListings', listings);
|
|
});
|
|
|
|
RegisterNuiCallbackType(MarketplaceEvents.ADD_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);
|
|
});
|