mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-18 03:16:21 +02:00
First public commit
This commit is contained in:
commit
e05cd62e53
228 changed files with 17717 additions and 0 deletions
33
pages/demo.tsx
Normal file
33
pages/demo.tsx
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { GetStaticProps, NextPage } from "next";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
|
||||
import { usePlausible } from "next-plausible";
|
||||
import { useRouter } from "next/router";
|
||||
import React from "react";
|
||||
import { useMount } from "react-use";
|
||||
import { createDemo } from "../api-client/create-demo";
|
||||
import FullPageLoader from "../components/full-page-loader";
|
||||
|
||||
const Demo: NextPage = () => {
|
||||
const { t } = useTranslation("app");
|
||||
|
||||
const router = useRouter();
|
||||
const plausible = usePlausible();
|
||||
useMount(async () => {
|
||||
const poll = await createDemo();
|
||||
plausible("Create demo poll");
|
||||
router.replace(`/admin/${poll.urlId}`);
|
||||
});
|
||||
|
||||
return <FullPageLoader>{t("creatingDemo")}</FullPageLoader>;
|
||||
};
|
||||
|
||||
export const getStaticProps: GetStaticProps = async ({ locale = "en" }) => {
|
||||
return {
|
||||
props: {
|
||||
...(await serverSideTranslations(locale, ["app"])),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default Demo;
|
Loading…
Add table
Add a link
Reference in a new issue