Tarky
Tarky
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Tarky on 6/18/2024 in #questions
Brand new T3 stack project warnings
No description
11 replies
TTCTheo's Typesafe Cult
Created by Tarky on 5/30/2024 in #questions
How do you add a new field to Session User in NextAuth using T3 stack?
I added this in my auth.ts
declare module 'next-auth' {
interface Session extends DefaultSession {
user: {
id: string;
} & DefaultSession['user'];
}

interface User extends DefaultUser {
credits: number;
}
}
declare module 'next-auth' {
interface Session extends DefaultSession {
user: {
id: string;
} & DefaultSession['user'];
}

interface User extends DefaultUser {
credits: number;
}
}
Then in my session callback
callbacks: {
session: ({ session, user }) => ({
...session,
user: {
...session.user,
id: user.id,
credits: user.credits,
},
}),
},
callbacks: {
session: ({ session, user }) => ({
...session,
user: {
...session.user,
id: user.id,
credits: user.credits,
},
}),
},
And still I am not being able to retrieve this credits field from the user table in my DB. Here's my user table created with Drizzle
export const users = createTable('user', {
id: varchar('id', { length: 255 }).notNull().primaryKey(),
name: varchar('name', { length: 255 }),
email: varchar('email', { length: 255 }).notNull(),
emailVerified: timestamp('emailVerified', {
mode: 'date',
}).default(sql`CURRENT_TIMESTAMP`),
image: varchar('image', { length: 255 }),
credits: integer('credits').default(0),
});
export const users = createTable('user', {
id: varchar('id', { length: 255 }).notNull().primaryKey(),
name: varchar('name', { length: 255 }),
email: varchar('email', { length: 255 }).notNull(),
emailVerified: timestamp('emailVerified', {
mode: 'date',
}).default(sql`CURRENT_TIMESTAMP`),
image: varchar('image', { length: 255 }),
credits: integer('credits').default(0),
});
2 replies
TTCTheo's Typesafe Cult
Created by Tarky on 4/18/2024 in #questions
Guide to upgrade from Pages router to App router
Is there a guide somewhere to convert a T3 stack app from pages router to app router? I am currently developing an app but I feel that if I dont change it to the approuter I will be missing important stuff or improvements in Next.js. - TypeScript - tRCP - NextAuth - Prisma w/ Supabase
2 replies