feat(Marketplace): minor alerts

This commit is contained in:
Christopher committed 2021-02-19 16:19:55 +01:00
1 parent 9846a4e1ae
commit 6d2961ac71
5 files changed
+33 -4

No files matched your search

@@ -2,9 +2,13 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
import { selloutState } from './state';
import { useListing } from './useListing';
import { useSetRecoilState } from 'recoil';
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
export const useSelloutService = () => {
const setSellout = useSetRecoilState(selloutState.listing);
const { addAlert } = useSnackbar();
useNuiEvent('SELLOUT', 'setAlert', addAlert);
useNuiEvent('SELLOUT', 'setListings', setSellout);
return useListing();
};
};
+3
View File
@@ -100,6 +100,9 @@
"APPS_SETTINGS_OPTION_RINGTONE": "Ringtone",
"APPS_SETTINGS_OPTION_RINGTONEVOL": "Ringtone Volume",
"APPS_MARKETPLACE_CREATE_LISTING_SUCCESS": "Successfully created a new listing",
"APPS_MARKETPALCE_CREATE_LISTING_FAILED": "Failed to create a new listing",
"GENERIC_SAVE": "Save",
"GENERIC_UPDATE": "Update",
"GENERIC_DELETE": "Delete"
+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',