feat: add hook useShowToast.ts
All checks were successful
it-academy/dry-wash-pl/pipeline/pr-main This commit looks good

This commit is contained in:
2025-02-08 22:18:32 +03:00
parent a00aaff29d
commit ed8ae95436
9 changed files with 65 additions and 102 deletions

View File

@@ -10,7 +10,6 @@ import {
Button,
useDisclosure,
Flex,
useToast,
Td,
Text,
Spinner,
@@ -20,6 +19,7 @@ import { useTranslation } from 'react-i18next';
import MasterItem from '../MasterItem';
import MasterDrawer from '../MasterDrawer';
import { useGetMastersQuery } from '../../__data__/service/api';
import useShowToast from '../../hooks/useShowToast';
const TABLE_HEADERS = [
'name' as const,
@@ -30,7 +30,8 @@ const TABLE_HEADERS = [
const Masters = () => {
const { isOpen, onOpen, onClose } = useDisclosure();
const toast = useToast();
const showToast = useShowToast();
const { t } = useTranslation('~', {
keyPrefix: 'dry-wash.arm.master',
});
@@ -39,12 +40,7 @@ const Masters = () => {
useEffect(() => {
if (error) {
toast({
title: t('error.title'),
status: 'error',
isClosable: true,
position: 'bottom-right',
});
showToast(t('error.title'), 'error');
}
}, [error]);