Skip to content

Commit d327e7c

Browse files
committed
fix(auth): save accepted marketing from traits
1 parent 9f7624c commit d327e7c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/betterAuth.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ export const getBetterAuthOptions = (pool: Pool): BetterAuthOptions => {
468468
const setClauses: string[] = [
469469
`flags = CASE WHEN flags = '{}' THEN '{"trustScore": 1, "vordr": false}' ELSE flags END`,
470470
];
471-
const values: string[] = [user.id];
471+
const values: unknown[] = [user.id];
472472
let paramIndex = 2;
473473

474474
const hookCtx = ctx as BetterAuthDbHookContext;
@@ -497,6 +497,12 @@ export const getBetterAuthOptions = (pool: Pool): BetterAuthOptions => {
497497
);
498498
addField('timezone', body?.timezone ?? oauthState?.timezone);
499499

500+
if (typeof body?.acceptedMarketing === 'boolean') {
501+
setClauses.push(`"acceptedMarketing" = $${paramIndex}`);
502+
values.push(body.acceptedMarketing);
503+
paramIndex++;
504+
}
505+
500506
const ip =
501507
hookCtx?.request?.headers
502508
?.get('x-forwarded-for')

0 commit comments

Comments
 (0)