mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Change SnackbarProviderAlert message property to allow for any string rather than a explicit translation key
24 lines
762 B
TypeScript
24 lines
762 B
TypeScript
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
|
import { selloutState } from './state';
|
|
import { useListing } from './useListing';
|
|
import { useSetRecoilState } from 'recoil';
|
|
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export const useSelloutService = () => {
|
|
const setSellout = useSetRecoilState(selloutState.listing);
|
|
const { addAlert } = useSnackbar();
|
|
const { t } = useTranslation();
|
|
|
|
const handleAddAlert = ({ message, type }: IAlert) => {
|
|
addAlert({
|
|
message: t(`APPS_${message}`),
|
|
type,
|
|
});
|
|
};
|
|
|
|
useNuiEvent('SELLOUT', 'setAlert', handleAddAlert);
|
|
useNuiEvent('SELLOUT', 'setListings', setSellout);
|
|
return useListing();
|
|
};
|