chore(auth): update NextAuth configuration to include JWT language
chore(eslint): add warning rule for unused variables in ESLint configuration
This commit is contained in:
parent
b69cc453e8
commit
52a7ee5d0b
@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": ["next/core-web-vitals", "next/typescript"],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": "warn",
|
||||
"@typescript-eslint/no-empty-object-type": "warn"
|
||||
}
|
||||
}
|
||||
|
14
src/auth.ts
14
src/auth.ts
@ -1,13 +1,14 @@
|
||||
import NextAuth, { type DefaultSession } from "next-auth";
|
||||
import NextAuth from "next-auth";
|
||||
import { JWT } from "next-auth/jwt";
|
||||
import Gitea, { GiteaProfile } from "@/lib/providers/gitea";
|
||||
|
||||
declare module "next-auth" {
|
||||
interface User extends GiteaProfile {}
|
||||
}
|
||||
|
||||
interface Session {
|
||||
user: {
|
||||
language: string;
|
||||
} & DefaultSession["user"];
|
||||
declare module "next-auth/jwt" {
|
||||
interface JWT {
|
||||
language?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,8 +31,9 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
|
||||
return token;
|
||||
},
|
||||
session({ session, token }) {
|
||||
session.user.language = token.language as string;
|
||||
session.user.language = token.language;
|
||||
return session;
|
||||
},
|
||||
},
|
||||
debug: process.env.NODE_ENV === "development",
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user