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

23 lines
583 B
JavaScript
Raw Normal View History

import React from 'react';
2020-08-15 10:17:15 +02:00
import { useRouter } from 'next/router';
import Layout from 'components/layout/Layout';
import WebsiteDetails from 'components/WebsiteDetails';
import useFetch from 'hooks/useFetch';
2020-08-15 10:17:15 +02:00
export default function SharePage() {
const router = useRouter();
const { id, frame } = router.query;
const shareId = id?.[0];
const { data } = useFetch(shareId ? `/api/share/${shareId}` : null);
2020-08-15 10:17:15 +02:00
if (!data) {
return null;
2020-08-15 10:17:15 +02:00
}
return (
<Layout header={!frame} footer={!frame}>
<WebsiteDetails websiteId={data.website_id} />
2020-08-15 10:17:15 +02:00
</Layout>
);
}