mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
feat(Marketplace): minor alerts
This commit is contained in:
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 { selloutState } from './state';
|
||||||
import { useListing } from './useListing';
|
import { useListing } from './useListing';
|
||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||||
|
|
||||||
export const useSelloutService = () => {
|
export const useSelloutService = () => {
|
||||||
const setSellout = useSetRecoilState(selloutState.listing);
|
const setSellout = useSetRecoilState(selloutState.listing);
|
||||||
|
const { addAlert } = useSnackbar();
|
||||||
|
|
||||||
|
useNuiEvent('SELLOUT', 'setAlert', addAlert);
|
||||||
useNuiEvent('SELLOUT', 'setListings', setSellout);
|
useNuiEvent('SELLOUT', 'setListings', setSellout);
|
||||||
return useListing();
|
return useListing();
|
||||||
};
|
};
|
||||||
@@ -100,6 +100,9 @@
|
|||||||
"APPS_SETTINGS_OPTION_RINGTONE": "Ringtone",
|
"APPS_SETTINGS_OPTION_RINGTONE": "Ringtone",
|
||||||
"APPS_SETTINGS_OPTION_RINGTONEVOL": "Ringtone Volume",
|
"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_SAVE": "Save",
|
||||||
"GENERIC_UPDATE": "Update",
|
"GENERIC_UPDATE": "Update",
|
||||||
"GENERIC_DELETE": "Delete"
|
"GENERIC_DELETE": "Delete"
|
||||||
|
|||||||
@@ -12,11 +12,21 @@ onNet(events.SELLOUT_SEND_LISTING, (listing: any) => {
|
|||||||
|
|
||||||
RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING);
|
RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING);
|
||||||
on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: any) => {
|
on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: any) => {
|
||||||
const listing = data;
|
emitNet(events.SELLOUT_ADD_LISTING, data);
|
||||||
emitNet(events.SELLOUT_ADD_LISTING, listing);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
emitNet(events.SELLOUT_FETCH_LISTING);
|
emitNet(events.SELLOUT_FETCH_LISTING);
|
||||||
console.log('Fetched');
|
console.log('Fetched');
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
onNet(events.SELLOUT_ACTION_RESULT, (alert: { message: string, type: string }) => {
|
||||||
|
SendNuiMessage(
|
||||||
|
JSON.stringify({
|
||||||
|
app: "SELLOUT",
|
||||||
|
method: "setAlert",
|
||||||
|
data: alert
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
@@ -62,9 +62,19 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
|
|||||||
|
|
||||||
const phoneNumber = await usePhoneNumber(_identifier);
|
const phoneNumber = await usePhoneNumber(_identifier);
|
||||||
await addListing(_identifier, name, phoneNumber, listing);
|
await addListing(_identifier, name, phoneNumber, listing);
|
||||||
|
|
||||||
|
emitNet(events.SELLOUT_ACTION_RESULT, _source, {
|
||||||
|
message: 'MARKETPLACE_CREATE_LISTING_SUCCESS',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
selloutLogger.error(`Failed to add listing ${e.message}`, {
|
selloutLogger.error(`Failed to add listing ${e.message}`, {
|
||||||
source: _source,
|
source: _source,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
emitNet(events.SELLOUT_ACTION_RESULT, _source, {
|
||||||
|
message: 'MARKETPALCE_CREATE_LISTING_FAILED',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -37,11 +37,13 @@ export default {
|
|||||||
CONTACTS_DELETE_CONTACT: 'phone:deleteContact',
|
CONTACTS_DELETE_CONTACT: 'phone:deleteContact',
|
||||||
CONTACTS_DELETE_CONTACT_SUCCESS: 'contacts:deleteSuccess',
|
CONTACTS_DELETE_CONTACT_SUCCESS: 'contacts:deleteSuccess',
|
||||||
CONTACTS_UPDATE_CONTACT_SUCCESS: 'phone:updateContactSuccess',
|
CONTACTS_UPDATE_CONTACT_SUCCESS: 'phone:updateContactSuccess',
|
||||||
|
CONTACTS_ACTION_RESULT: 'phone:contactActionResult',
|
||||||
|
|
||||||
// Sellout
|
// Sellout
|
||||||
SELLOUT_ADD_LISTING: 'phone:addListing',
|
SELLOUT_ADD_LISTING: 'phone:addListing',
|
||||||
SELLOUT_FETCH_LISTING: 'phone:fetchAllListings',
|
SELLOUT_FETCH_LISTING: 'phone:fetchAllListings',
|
||||||
SELLOUT_SEND_LISTING: 'phone:sendAllListings',
|
SELLOUT_SEND_LISTING: 'phone:sendAllListings',
|
||||||
|
SELLOUT_ACTION_RESULT: 'phone:selloutActionResult',
|
||||||
|
|
||||||
//
|
//
|
||||||
BANK_ADD_TRANSFER: 'phone:addTransfer',
|
BANK_ADD_TRANSFER: 'phone:addTransfer',
|
||||||
@@ -66,6 +68,7 @@ export default {
|
|||||||
MESSAGES_FETCH_MESSAGES: 'phone:fetchMessages',
|
MESSAGES_FETCH_MESSAGES: 'phone:fetchMessages',
|
||||||
MESSAGES_FETCH_MESSAGES_SUCCESS: 'phone:fetchMessagesSuccess',
|
MESSAGES_FETCH_MESSAGES_SUCCESS: 'phone:fetchMessagesSuccess',
|
||||||
MESSAGES_FETCH_MESSAGES_FAILED: 'phone:fetchMessagesFailed',
|
MESSAGES_FETCH_MESSAGES_FAILED: 'phone:fetchMessagesFailed',
|
||||||
|
MESSAGES_ACTION_RESULT: 'phone:messagesActionResult',
|
||||||
|
|
||||||
// Notes
|
// Notes
|
||||||
NOTE_ADD_NOTE: 'phone:addNote',
|
NOTE_ADD_NOTE: 'phone:addNote',
|
||||||
@@ -95,7 +98,6 @@ export default {
|
|||||||
CAMERA_SEND_PHOTOS: 'phone:SendPhotos',
|
CAMERA_SEND_PHOTOS: 'phone:SendPhotos',
|
||||||
CAMERA_DELETE_PHOTO: 'photo:deletePhoto',
|
CAMERA_DELETE_PHOTO: 'photo:deletePhoto',
|
||||||
CAMERA_DELETE_PHOTO_SUCCESS: 'phone:deletePhotoSuccess',
|
CAMERA_DELETE_PHOTO_SUCCESS: 'phone:deletePhotoSuccess',
|
||||||
CONTACTS_ACTION_RESULT: 'phone:contactActionResult',
|
|
||||||
// copy
|
// copy
|
||||||
PHONE_USE_CLIPBOARD: 'phone:useClipboard',
|
PHONE_USE_CLIPBOARD: 'phone:useClipboard',
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user