Skip to content

Commit

Permalink
capture new user
Browse files Browse the repository at this point in the history
  • Loading branch information
potts99 committed Dec 3, 2023
1 parent 8eddf15 commit 6376b14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/api/src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import axios from "axios";
import bcrypt from "bcrypt";
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
import jwt from "jsonwebtoken";
import { track } from "../lib/hog";
import { checkToken } from "../lib/jwt";
import { forgotPassword } from "../lib/nodemailer/auth/forgot-password";
import { prisma } from "../prisma";
Expand Down Expand Up @@ -44,7 +45,7 @@ export function authRoutes(fastify: FastifyInstance) {
});
}

await prisma.user.create({
const user = await prisma.user.create({
data: {
email,
password: await bcrypt.hash(password, 10),
Expand All @@ -53,6 +54,13 @@ export function authRoutes(fastify: FastifyInstance) {
},
});

const hog = track();

hog.capture({
event: "user_registered",
distinctId: user.id,
});

reply.send({
success: true,
});
Expand Down

0 comments on commit 6376b14

Please sign in to comment.