diff --git a/src/pages/catalogue/components/CatalogueItem.tsx b/src/pages/catalogue/components/CatalogueItem.tsx index 9179992..8baaf47 100644 --- a/src/pages/catalogue/components/CatalogueItem.tsx +++ b/src/pages/catalogue/components/CatalogueItem.tsx @@ -2,6 +2,8 @@ import { type FC } from 'react' import { Edit, Eye, Share, Trash } from 'iconsax-react' import type { CatalogItemType } from '../types/Types' import moment from 'moment-jalaali' +import { Link } from 'react-router-dom' +import { Paths } from '@/config/Paths' type Props = { item: CatalogItemType @@ -25,9 +27,11 @@ const CatalogueItem: FC = ({ item }) => {
-
- -
+ +
+ +
+
diff --git a/src/pages/home/Home.tsx b/src/pages/home/Home.tsx index e71ea40..a84583e 100644 --- a/src/pages/home/Home.tsx +++ b/src/pages/home/Home.tsx @@ -6,9 +6,12 @@ import Button from '@/components/Button' import Input from '@/components/Input' import { toast } from '@/components/Toast' import { useCreateCatalog } from './hooks/useHomeData' +import { useNavigate } from 'react-router-dom' +import { Paths } from '@/config/Paths' const Home: FC = () => { + const navigate = useNavigate() const [active, setActive] = useState('a4') const [name, setName] = useState('') const { mutate: createCatalog, isPending } = useCreateCatalog() @@ -18,12 +21,11 @@ const Home: FC = () => { toast('نام کاتالوگ را وارد کنید', 'error') } else { createCatalog({ name: name, size: active, content: '' }, { - onSuccess: () => { + onSuccess: (data) => { toast('کاتالوگ با موفقیت ساخته شد', 'success') + navigate(Paths.editor + `/${data?.data?.id}`) }, - onError: (err) => { - console.log(err); - + onError: () => { toast('خطا در ساخت کاتالوگ', 'error') } }) diff --git a/src/router/MainRouter.tsx b/src/router/MainRouter.tsx index 3b7381e..f4f19c1 100644 --- a/src/router/MainRouter.tsx +++ b/src/router/MainRouter.tsx @@ -32,7 +32,7 @@ const MainRouter = () => {
} /> - } /> + } /> } /> } />