Handle website delete. Added response helper functions.

This commit is contained in:
Mike Cao 2020-08-07 17:19:42 -07:00
parent 0a411a9ad6
commit c4b75e4aec
31 changed files with 314 additions and 96 deletions

View file

@ -1,13 +1,21 @@
import Head from 'next/head';
import Link from 'next/link';
import { useRouter } from 'next/router';
import Layout from 'components/layout/Layout';
export default function Test({ websiteId }) {
export default function Test() {
const router = useRouter();
const { id } = router.query;
if (!id) {
return <h1>No id query specified.</h1>;
}
return (
<>
<Head>
{typeof window !== 'undefined' && (
<script async defer data-website-id={websiteId} src="/umami.js" />
<script async defer data-website-id={id} src="/umami.js" />
)}
</Head>
<Layout>
@ -17,17 +25,17 @@ export default function Test({ websiteId }) {
trigger page views. Clicking on the button should trigger an event.
</p>
<h2>Page links</h2>
<Link href="?q=1">
<Link href={`?id=${id}&q=1`}>
<a>Page One</a>
</Link>
<br />
<Link href="?q=2">
<Link href={`?id=${id}&q=2`}>
<a>Page Two</a>
</Link>
<h2>Events</h2>
<button
id="primary-button"
className="otherClass umami--click--primary-button"
className="otherClass umami--click--primary-button align-self-start"
type="button"
>
Button
@ -36,11 +44,3 @@ export default function Test({ websiteId }) {
</>
);
}
export async function getStaticProps() {
return {
props: {
websiteId: process.env.TEST_WEBSITE_ID,
},
};
}