You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 824B

12345678910111213141516171819202122232425262728293031
  1. import { GetStaticProps, NextPage } from 'next';
  2. import { getSession } from 'next-auth/react';
  3. import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
  4. import { useRouter } from 'next/router';
  5. import { useEffect } from 'react';
  6. import LoginForm from '../../components/forms/login/LoginForm';
  7. import { BASE_PAGE } from '../../constants/pages';
  8. const AuthPage: NextPage = () => {
  9. const router = useRouter();
  10. useEffect(() => {
  11. getSession().then((session) => {
  12. if (session) {
  13. router.replace(BASE_PAGE);
  14. }
  15. });
  16. }, [router]);
  17. return <LoginForm></LoginForm>;
  18. };
  19. export const getStaticProps: GetStaticProps = async ({ locale }: any) => {
  20. return {
  21. props: {
  22. ...(await serverSideTranslations(locale, ['forms', 'login'])),
  23. },
  24. };
  25. };
  26. export default AuthPage;