mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +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';
|
||||
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { CodeHostType } from "@/lib/utils";
|
||||
import { getCodeHostIcon } from "@/lib/utils";
|
||||
import {
|
||||
|
|
@ -15,6 +15,8 @@ import { OnboardingSteps } from "@/lib/constants";
|
|||
import { BackButton } from "./onboardBackButton";
|
||||
import { CodeHostIconButton } from "../../components/codeHostIconButton";
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
||||
import { useSession } from "next-auth/react";
|
||||
import posthog from "posthog-js";
|
||||
|
||||
interface ConnectCodeHostProps {
|
||||
nextStep: OnboardingSteps;
|
||||
|
|
@ -23,6 +25,19 @@ interface ConnectCodeHostProps {
|
|||
export const ConnectCodeHost = ({ nextStep }: ConnectCodeHostProps) => {
|
||||
const [selectedCodeHost, setSelectedCodeHost] = useState<CodeHostType | null>(null);
|
||||
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(() => {
|
||||
router.push(`?step=${nextStep}`);
|
||||
}, [nextStep, router]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue