TTC
Theo's Typesafe CultDebaucus
Change ctx.session.user values to include new ones? Bad idea?
Right now when using
ctx.session.user
I get a few default options that come with t3-app.
.id
, .name?
, .image?
and .email?
. Is there a way to change this to include new values? I can't find an obvious spot or I am being silly.Solution
TobyMcCann•352d ago
You can do this in your auth.ts where the next-auth module is extended. Make sure you don't add anything sensitive when extending.
```
import type { Role } from "@prisma/client";
import { DefaultSession } from "next-auth";
declare module "next-auth" {
interface Session {
user?: {
id: string;
role: Role
} & DefaultSession["user"];
}
interface User {
id: string;
role: Role;
// ...other properties
}
}
Debaucus•352d ago
@TobyMcCann Thank you!
Additionally, I had to add it to my
callbacks: []
in order for it to function as I wanted, but it is now working.21KMembers
View on DiscordWant results from more Discord servers?
More PostsNext13 app-router: How to get request headers on client page comp?All my pages are client components because I want to use page transitions and need to wrap them in aCan i send a file from trcp router?I want to send a xlxs/csv file to FE (expo). Can i do this like expressJs? or do i need to first upluseSession has an empty user object {}When using the useSession hook, session.data contains `{ user: {}, expires: '2023-06-30T20:30:42.181TypeSafe external API ?I am currently communicating with an external API and after falling in love with TRPC, I would like Want to request only half of the audio file but not workingi request an audio file from my server and stream it to the browser .. on the browser i make a requeHow is realtime DB syncing accomplished without Firestore/Supabase?Hi! I've been working with Firestore for a long time now and gotten very used to the realtime db synDrag and drop library recommendation?Whats the community-favorite option right now? I saw that react-beautiful-dnd isn't being maintainedtRPC invalid_type error with ClerkHi, I have this weird issue I've been trying to resolve for a while now.
This is the error in browsSave selected option on dropdownHii, I have a dropdown list that is being made from an array and a Save button. When I click the savEnd-to-end testing tools, SuggestionsHey everyone! 😄
I hope you're all doing well. 👋
I have a couple of questions for you, and I'd re