umami/pages/share/[...id].js

22 lines
550 B
JavaScript
Raw Normal View History

2020-08-15 10:17:15 +02:00
import { useRouter } from 'next/router';
import ShareLayout from 'components/layout/ShareLayout';
2023-07-10 09:33:30 +02:00
import WebsiteDetailsPage from 'components/pages/websites/WebsiteDetailsPage';
2020-10-11 11:29:55 +02:00
import useShareToken from 'hooks/useShareToken';
2020-08-15 10:17:15 +02:00
2023-07-10 09:33:30 +02:00
export default function () {
2020-08-15 10:17:15 +02:00
const router = useRouter();
const { id } = router.query;
const shareId = id?.[0];
2020-10-11 11:29:55 +02:00
const shareToken = useShareToken(shareId);
2020-08-15 10:17:15 +02:00
2020-10-11 11:29:55 +02:00
if (!shareToken) {
return null;
2020-08-15 10:17:15 +02:00
}
return (
<ShareLayout>
2023-07-10 09:33:30 +02:00
<WebsiteDetailsPage websiteId={shareToken.websiteId} />
</ShareLayout>
2020-08-15 10:17:15 +02:00
);
}