Skip to content

Commit

Permalink
fix: ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
mxkaske committed Dec 27, 2024
1 parent 832b3a2 commit 5efaf00
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/api/src/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ const enforceUserIsAuthed = t.middleware(async (opts) => {
// REMINDER: We only track the event if the request was successful
// REMINDER: We are not blocking the request
after(async () => {
const { ctx, meta, getRawInput } = opts;
const { meta, getRawInput } = opts;
if (meta?.track) {
let identify: IdentifyProps = {};

if (ctx.user && ctx.workspace) {
if (user && workspace) {
identify = {
userId: `usr_${ctx.user.id}`,
email: ctx.user.email || undefined,
workspaceId: String(ctx.workspace.id),
plan: ctx.workspace.plan,
userId: `usr_${user.id}`,
email: user.email || undefined,
workspaceId: String(workspace.id),
plan: workspace.plan,
};
}

Expand Down

0 comments on commit 5efaf00

Please sign in to comment.