diff --git a/src/pages/catalogue/components/CatalogueItem.tsx b/src/pages/catalogue/components/CatalogueItem.tsx index beac1b7..44ee182 100644 --- a/src/pages/catalogue/components/CatalogueItem.tsx +++ b/src/pages/catalogue/components/CatalogueItem.tsx @@ -2,6 +2,7 @@ import { toast } from "@/components/Toast"; import TrashWithConfrim from "@/components/TrashWithConfrim"; import { Paths } from "@/config/Paths"; import { extractErrorMessage } from "@/helpers/utils"; +import { useGetBusiness } from "@/pages/business/hooks/useBusinessData"; import { useDleteCatalog } from "@/pages/catalogue/hooks/useCatalogueData"; import { requestViewerFullscreen } from "@/pages/viewer/utils/viewerFullscreen"; import { Edit, Eye, Share } from "iconsax-react"; @@ -17,9 +18,10 @@ type Props = { }; const CatalogueItem: FC = ({ item, refetch }) => { + const { data: business } = useGetBusiness(); const deleteCatalog = useDleteCatalog(); - const shareUrl = `${window.location.origin}${Paths.viewer}/${item.id}`; + const shareUrl = `${window.location.origin}${Paths.viewerBySlug}/${business?.data?.slug}/${item.slug}`; const handleShare = async () => { try { @@ -68,7 +70,7 @@ const CatalogueItem: FC = ({ item, refetch }) => {
diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index 3704037..a8cfd17 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -1,6 +1,7 @@ import Input from "@/components/Input"; import { Paths } from "@/config/Paths"; import { clx } from "@/helpers/utils"; +import { useGetBusiness } from "@/pages/business/hooks/useBusinessData"; import HeaderUserMenu from "@/shared/components/HeaderUserMenu"; import { useSharedStore } from "@/shared/store/sharedStore"; import { Eye, HambergerMenu } from "iconsax-react"; @@ -41,8 +42,9 @@ const Header: FC = ({ setSearch, editorCatalogSlug, } = useSharedStore(); - const location = useLocation(); + const { data: business } = useGetBusiness(); + const location = useLocation(); const editorPathPrefix = `${Paths.editor}/`; const isEditorRoute = location.pathname.startsWith(editorPathPrefix) && @@ -84,7 +86,7 @@ const Header: FC = ({ {isEditorRoute && viewerSlug ? (