feat(Marketplace): minor alerts

This commit is contained in:
Christopher committed 2021-02-19 18:26:53 +01:00
1 parent 283832f17e
commit 5244ff3a57
5 files changed
+33 -4

No files matched your search

+12 -2
View File
@@ -12,11 +12,21 @@ onNet(events.SELLOUT_SEND_LISTING, (listing: any) => {
RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING);
on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: any) => {
const listing = data;
emitNet(events.SELLOUT_ADD_LISTING, listing);
emitNet(events.SELLOUT_ADD_LISTING, data);
setTimeout(() => {
emitNet(events.SELLOUT_FETCH_LISTING);
console.log('Fetched');
}, 500);
});
onNet(events.SELLOUT_ACTION_RESULT, (alert: { message: string, type: string }) => {
SendNuiMessage(
JSON.stringify({
app: "SELLOUT",
method: "setAlert",
data: alert
})
)
})
+10
View File
@@ -62,9 +62,19 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
const phoneNumber = await usePhoneNumber(_identifier);
await addListing(_identifier, name, phoneNumber, listing);
emitNet(events.SELLOUT_ACTION_RESULT, _source, {
message: 'MARKETPLACE_CREATE_LISTING_SUCCESS',
type: 'success'
})
} catch (e) {
selloutLogger.error(`Failed to add listing ${e.message}`, {
source: _source,
});
emitNet(events.SELLOUT_ACTION_RESULT, _source, {
message: 'MARKETPALCE_CREATE_LISTING_FAILED',
type: 'error'
})
}
});
+3 -1
View File
@@ -37,11 +37,13 @@ export default {
CONTACTS_DELETE_CONTACT: 'phone:deleteContact',
CONTACTS_DELETE_CONTACT_SUCCESS: 'contacts:deleteSuccess',
CONTACTS_UPDATE_CONTACT_SUCCESS: 'phone:updateContactSuccess',
CONTACTS_ACTION_RESULT: 'phone:contactActionResult',
// Sellout
SELLOUT_ADD_LISTING: 'phone:addListing',
SELLOUT_FETCH_LISTING: 'phone:fetchAllListings',
SELLOUT_SEND_LISTING: 'phone:sendAllListings',
SELLOUT_ACTION_RESULT: 'phone:selloutActionResult',
//
BANK_ADD_TRANSFER: 'phone:addTransfer',
@@ -66,6 +68,7 @@ export default {
MESSAGES_FETCH_MESSAGES: 'phone:fetchMessages',
MESSAGES_FETCH_MESSAGES_SUCCESS: 'phone:fetchMessagesSuccess',
MESSAGES_FETCH_MESSAGES_FAILED: 'phone:fetchMessagesFailed',
MESSAGES_ACTION_RESULT: 'phone:messagesActionResult',
// Notes
NOTE_ADD_NOTE: 'phone:addNote',
@@ -95,7 +98,6 @@ export default {
CAMERA_SEND_PHOTOS: 'phone:SendPhotos',
CAMERA_DELETE_PHOTO: 'photo:deletePhoto',
CAMERA_DELETE_PHOTO_SUCCESS: 'phone:deletePhotoSuccess',
CONTACTS_ACTION_RESULT: 'phone:contactActionResult',
// copy
PHONE_USE_CLIPBOARD: 'phone:useClipboard',