mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-13 17:06:48 +02:00
📈 Conditionally initialize posthog (#586)
This commit is contained in:
parent
4062b572a0
commit
d9061d45fa
12 changed files with 79 additions and 53 deletions
|
@ -1,9 +1,10 @@
|
|||
import { useRouter } from "next/router";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import posthog from "posthog-js";
|
||||
import React from "react";
|
||||
import { useSessionStorage } from "react-use";
|
||||
|
||||
import { usePostHog } from "@/utils/posthog";
|
||||
|
||||
import { encodeDateOption } from "../utils/date-time-utils";
|
||||
import { trpc } from "../utils/trpc";
|
||||
import { Button } from "./button";
|
||||
|
@ -89,10 +90,12 @@ const Page: React.FunctionComponent<CreatePollPageProps> = ({
|
|||
|
||||
const [isRedirecting, setIsRedirecting] = React.useState(false);
|
||||
|
||||
const posthog = usePostHog();
|
||||
|
||||
const createPoll = trpc.polls.create.useMutation({
|
||||
onSuccess: (res) => {
|
||||
setIsRedirecting(true);
|
||||
posthog.capture("created poll", {
|
||||
posthog?.capture("created poll", {
|
||||
pollId: res.id,
|
||||
numberOfOptions: formData.options?.options?.length,
|
||||
optionsView: formData?.options?.view,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue