12345678910111213141516171819202122232425262728293031 |
- import { GetStaticProps, NextPage } from 'next';
- import { getSession } from 'next-auth/react';
- import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
- import { useRouter } from 'next/router';
- import { useEffect } from 'react';
- import LoginForm from '../../components/forms/login/LoginForm';
- import { BASE_PAGE } from '../../constants/pages';
-
- const AuthPage: NextPage = () => {
- const router = useRouter();
-
- useEffect(() => {
- getSession().then((session) => {
- if (session) {
- router.replace(BASE_PAGE);
- }
- });
- }, [router]);
-
- return <LoginForm></LoginForm>;
- };
-
- export const getStaticProps: GetStaticProps = async ({ locale }: any) => {
- return {
- props: {
- ...(await serverSideTranslations(locale, ['forms', 'login'])),
- },
- };
- };
-
- export default AuthPage;
|