mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-15 05:45:20 +00:00
add posthog identify call after registeration
This commit is contained in:
parent
d439933afc
commit
eab0007602
1 changed files with 16 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { CodeHostType } from "@/lib/utils";
|
import { CodeHostType } from "@/lib/utils";
|
||||||
import { getCodeHostIcon } from "@/lib/utils";
|
import { getCodeHostIcon } from "@/lib/utils";
|
||||||
import {
|
import {
|
||||||
|
|
@ -15,6 +15,8 @@ import { OnboardingSteps } from "@/lib/constants";
|
||||||
import { BackButton } from "./onboardBackButton";
|
import { BackButton } from "./onboardBackButton";
|
||||||
import { CodeHostIconButton } from "../../components/codeHostIconButton";
|
import { CodeHostIconButton } from "../../components/codeHostIconButton";
|
||||||
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
||||||
|
import { useSession } from "next-auth/react";
|
||||||
|
import posthog from "posthog-js";
|
||||||
|
|
||||||
interface ConnectCodeHostProps {
|
interface ConnectCodeHostProps {
|
||||||
nextStep: OnboardingSteps;
|
nextStep: OnboardingSteps;
|
||||||
|
|
@ -23,6 +25,19 @@ interface ConnectCodeHostProps {
|
||||||
export const ConnectCodeHost = ({ nextStep }: ConnectCodeHostProps) => {
|
export const ConnectCodeHost = ({ nextStep }: ConnectCodeHostProps) => {
|
||||||
const [selectedCodeHost, setSelectedCodeHost] = useState<CodeHostType | null>(null);
|
const [selectedCodeHost, setSelectedCodeHost] = useState<CodeHostType | null>(null);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { data: session } = useSession();
|
||||||
|
|
||||||
|
// Note: this is currently the first client side page that gets loaded after a user registers. If this changes, we need to update this.
|
||||||
|
// @nocheckin
|
||||||
|
useEffect(() => {
|
||||||
|
if (session?.user) {
|
||||||
|
posthog.identify(session.user.id, {
|
||||||
|
email: session.user.email,
|
||||||
|
name: session.user.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [session?.user]);
|
||||||
|
|
||||||
const onCreated = useCallback(() => {
|
const onCreated = useCallback(() => {
|
||||||
router.push(`?step=${nextStep}`);
|
router.push(`?step=${nextStep}`);
|
||||||
}, [nextStep, router]);
|
}, [nextStep, router]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue