Skip to content

Commit

Permalink
Merge pull request #5 from TEDx-SJEC/session
Browse files Browse the repository at this point in the history
Refactor: Update auth-options.ts to include user id in session
  • Loading branch information
Vyshnav001 authored Sep 12, 2024
2 parents bf54387 + 13a2acb commit 8a4528a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/auth-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { JWT } from "next-auth/jwt";
declare module "next-auth" {
interface Session {
user: {
id: string;
role: UserRoleType;
} & DefaultSession["user"];
}
Expand All @@ -34,6 +35,7 @@ export const authOptions: NextAuthOptions = {
if (user) {
return {
...token,
id: user.id,
role: user.role,
};
}
Expand All @@ -45,6 +47,7 @@ export const authOptions: NextAuthOptions = {
...session,
user: {
...session.user,
id: token.id,
role: token.role as UserRoleType,
},
};
Expand Down

0 comments on commit 8a4528a

Please sign in to comment.