Added serverside translations to the forgot password page. (#7618)

pull/7623/head
Jeroen Reumkens 2023-03-09 10:14:04 +01:00 committed by GitHub
parent 58b439ca65
commit 5ebbd514d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import type { ResetPasswordRequest } from "@prisma/client";
import debounce from "lodash/debounce"; import debounce from "lodash/debounce";
import type { GetServerSidePropsContext } from "next"; import type { GetServerSidePropsContext } from "next";
import { getCsrfToken } from "next-auth/react"; import { getCsrfToken } from "next-auth/react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Link from "next/link"; import Link from "next/link";
import React, { useMemo } from "react"; import React, { useMemo } from "react";
@ -185,6 +186,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
}, },
id, id,
csrfToken: await getCsrfToken({ req: context.req }), csrfToken: await getCsrfToken({ req: context.req }),
...(await serverSideTranslations(context.locale || "en", ["common"])),
}, },
}; };
} catch (reason) { } catch (reason) {

View File

@ -1,6 +1,7 @@
import debounce from "lodash/debounce"; import debounce from "lodash/debounce";
import type { GetServerSidePropsContext } from "next"; import type { GetServerSidePropsContext } from "next";
import { getCsrfToken } from "next-auth/react"; import { getCsrfToken } from "next-auth/react";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import type { SyntheticEvent } from "react"; import type { SyntheticEvent } from "react";
@ -144,5 +145,6 @@ ForgotPassword.getInitialProps = async (context: GetServerSidePropsContext) => {
return { return {
csrfToken: await getCsrfToken(context), csrfToken: await getCsrfToken(context),
...(await serverSideTranslations(context.locale || "en", ["common"])),
}; };
}; };