mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
refactor(server/marketplace): Refactor to use promise events
This commit is contained in:
1 parent
4afa9c691b
commit
3df2f88759
9 files changed
+160
-134
No files matched your search
@@ -51,21 +51,21 @@ export const ListingActions: React.FC<MarketplaceListing> = ({ children, ...list
|
||||
};
|
||||
|
||||
const handleReportListing = () => {
|
||||
fetchNui<MarketplaceActionResp>(MarketplaceEvents.DELETE_LISTING, listing).then(
|
||||
({ err, errMsg }) => {
|
||||
if (err) {
|
||||
return addAlert({
|
||||
message: t(errMsg),
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
addAlert({
|
||||
message: t('APPS_MARKETPLACE_REPORT_LISTING_SUCCESS'),
|
||||
type: 'success',
|
||||
fetchNui<MarketplaceActionResp>(MarketplaceEvents.REPORT_LISTING, {
|
||||
listingId: listing.id,
|
||||
}).then(({ err, errMsg }) => {
|
||||
if (err) {
|
||||
return addAlert({
|
||||
message: t(errMsg),
|
||||
type: 'error',
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
addAlert({
|
||||
message: t('APPS_MARKETPLACE_REPORT_LISTING_SUCCESS'),
|
||||
type: 'success',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const handleCall = () => {
|
||||
|
||||
@@ -56,7 +56,7 @@ export const ListingForm = () => {
|
||||
}).then(({ err, errMsg }) => {
|
||||
if (err) {
|
||||
return addAlert({
|
||||
message: t(errMsg),
|
||||
message: t('errMsg'),
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user