Initial commit: Tapalka monorepo (bot, front, strapi)
This commit is contained in:
53
CMyTapper/robucks-front/hooks/useNotify.tsx
Normal file
53
CMyTapper/robucks-front/hooks/useNotify.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
interface IUseNotifyReturn {
|
||||
getSuccessNotify: () => number | string;
|
||||
getErrorNotifyByNickname: () => number | string;
|
||||
getErrorNotifyByCount: () => number | string;
|
||||
}
|
||||
|
||||
export function useNotify(): IUseNotifyReturn {
|
||||
const getSuccessNotify = () => {
|
||||
return toast.success('Заявка успешно создана!', {
|
||||
position: 'top-left',
|
||||
autoClose: 3000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
style: { width: '250px', color: 'black', margin: '15px' },
|
||||
progress: undefined,
|
||||
theme: 'dark',
|
||||
});
|
||||
};
|
||||
|
||||
const getErrorNotifyByNickname = () => {
|
||||
return toast.error('Вы не указали ваш никнейм!', {
|
||||
position: 'top-left',
|
||||
autoClose: 3000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
style: { width: '250px', color: 'black', margin: '15px' },
|
||||
progress: undefined,
|
||||
theme: 'dark',
|
||||
});
|
||||
};
|
||||
|
||||
const getErrorNotifyByCount = () => {
|
||||
return toast.error('Вы не можете выбрать количество равное 0!', {
|
||||
position: 'top-left',
|
||||
autoClose: 3000,
|
||||
hideProgressBar: false,
|
||||
closeOnClick: true,
|
||||
pauseOnHover: true,
|
||||
draggable: true,
|
||||
style: { width: '250px', color: 'black', margin: '15px' },
|
||||
progress: undefined,
|
||||
theme: 'dark',
|
||||
});
|
||||
};
|
||||
|
||||
return { getSuccessNotify, getErrorNotifyByNickname, getErrorNotifyByCount };
|
||||
}
|
||||
Reference in New Issue
Block a user