tweak(phone/snackbar-provider): Altered API to expect a string for message, not a key (#135)

Change SnackbarProviderAlert message property to allow for any string rather than a explicit translation key
This commit is contained in:
Taso authored and GitHub committed 2021-03-04 22:40:17 -05:00
1 parent 9abac70427
commit 5c9c75c36c
10 files changed
+87 -19

No files matched your search

@@ -2,13 +2,22 @@ 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';
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();
useNuiEvent('SELLOUT', 'setAlert', addAlert);
const handleAddAlert = ({ message, type }: IAlert) => {
addAlert({
message: t(`APPS_${message}`),
type,
});
};
useNuiEvent('SELLOUT', 'setAlert', handleAddAlert);
useNuiEvent('SELLOUT', 'setListings', setSellout);
return useListing();
};