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