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"],
|
"extends": ["next/core-web-vitals", "next/typescript"],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-unused-vars": "warn",
|
||||||
"@typescript-eslint/no-empty-object-type": "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";
|
import Gitea, { GiteaProfile } from "@/lib/providers/gitea";
|
||||||
|
|
||||||
declare module "next-auth" {
|
declare module "next-auth" {
|
||||||
interface User extends GiteaProfile {}
|
interface User extends GiteaProfile {}
|
||||||
|
}
|
||||||
|
|
||||||
interface Session {
|
declare module "next-auth/jwt" {
|
||||||
user: {
|
interface JWT {
|
||||||
language: string;
|
language?: string;
|
||||||
} & DefaultSession["user"];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,8 +31,9 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
|
|||||||
return token;
|
return token;
|
||||||
},
|
},
|
||||||
session({ session, token }) {
|
session({ session, token }) {
|
||||||
session.user.language = token.language as string;
|
session.user.language = token.language;
|
||||||
return session;
|
return session;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
debug: process.env.NODE_ENV === "development",
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user