diff --git a/@types/next-auth.d.ts b/@types/next-auth.d.ts index 352e48e..b4b5e3e 100644 --- a/@types/next-auth.d.ts +++ b/@types/next-auth.d.ts @@ -8,7 +8,10 @@ declare module "next-auth" { * or the second parameter of the `session` callback, when using a database. */ interface User { - access_token?: string; + accessToken?: string; + accessTokenExpiration?: number; + refreshTokenExpiration?: number; + apiCookies?: string[]; apiUser?: APIUser; } @@ -17,7 +20,9 @@ declare module "next-auth" { */ interface Session { user: { - access_token?: string; + accessToken?: string; + accessTokenExpiration?: number; + refreshTokenExpiration?: number; apiUser?: APIUser; } & DefaultSession["user"]; } @@ -26,7 +31,10 @@ declare module "next-auth" { declare module "next-auth/jwt" { /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */ interface JWT { - access_token?: string; + accessToken?: string; + accessTokenExpiration?: number; + refreshTokenExpiration?: number; + apiCookies?: string[]; apiUser?: APIUser; } } diff --git a/@types/processenv.d.ts b/@types/processenv.d.ts new file mode 100644 index 0000000..2d75315 --- /dev/null +++ b/@types/processenv.d.ts @@ -0,0 +1,8 @@ +declare namespace NodeJS { + interface ProcessEnv { + NEXTAUTH_SECRET?: string; + NEXTAUTH_URL?: string; + NEXT_PUBLIC_API_BASE_URL?: string; + SERVICE_API_BASE_URL?: string; + } +} diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 84b8e75..527e84f 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -42,9 +42,7 @@ export default async function RootLayout({ children: React.ReactNode; params: { locale: AvailableLanguagesType }; }) { - // eslint-disable-next-line react-hooks/rules-of-hooks - const uncheckedLocale = useLocale(); - const locale = checkLanguage(uncheckedLocale); + const locale = checkLanguage(params.locale); const messages = await getMessages(locale); // Show a 404 error if the user requests an unknown locale diff --git a/app/[locale]/login/components/Form.tsx b/app/[locale]/login/components/Form.tsx index 08098b7..012ef4a 100644 --- a/app/[locale]/login/components/Form.tsx +++ b/app/[locale]/login/components/Form.tsx @@ -3,7 +3,7 @@ import { classNames } from "@/utils/classNames"; import { signIn } from "next-auth/react"; import { useTranslations } from "next-intl"; -import { FormEvent, useRef, useState } from "react"; +import { FormEvent, useLayoutEffect, useRef, useState } from "react"; import LoadingDotsSpinner from "./LoadingDotsSpinner"; import { useRouter } from "next/navigation"; @@ -69,6 +69,12 @@ const Form = ({ callbackUrl }: { callbackUrl?: string }) => { router.push("/register"); }; + useLayoutEffect(() => { + if (emailRef.current) { + emailRef.current.focus(); + } + }, []); + return (