Next.js template
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334
  1. import { getSession } from 'next-auth/react';
  2. import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
  3. import { useRouter } from 'next/router';
  4. import { useEffect } from 'react';
  5. import ForgotPasswordForm from '../../../components/forms/forgot-password/ForgotPasswordForm';
  6. import { BASE_PAGE } from '../../../constants/pages';
  7. const ForgotPasswordPage = () => {
  8. const router = useRouter();
  9. useEffect(() => {
  10. getSession().then((session) => {
  11. if (session) {
  12. router.replace(BASE_PAGE);
  13. }
  14. });
  15. }, [router]);
  16. return <ForgotPasswordForm />;
  17. };
  18. export async function getStaticProps({ locale }) {
  19. return {
  20. props: {
  21. ...(await serverSideTranslations(locale, [
  22. 'forms',
  23. 'forgotPass',
  24. 'common',
  25. ])),
  26. },
  27. };
  28. }
  29. export default ForgotPasswordPage;