message: Use ssg on login page and redirect home if user is authenticated
diff: -import { GetStaticProps } from 'next'
  -import { providers } from 'next-auth/client'
  +import { GetServerSideProps } from 'next'
  +import { getSession, providers } from 'next-auth/client'
  +import { routes } from 'common/routes'
  import LoginPage from 'components/auth/login/LoginPage'
  import { serverSideTranslations } from 'common/useNextLocale'
  @@ -8,11 +9,20 @@ type UnboxPromise<T extends Promise<any>> = T extends Promise<infer U> ? U : nev
  export type LoginPageProps = { providers: UnboxPromise<ReturnType<typeof providers>> }
  -export const getStaticProps: GetStaticProps<LoginPageProps> = async ({ locale }) => ({
  +export const getServerSideProps: GetServerSideProps<LoginPageProps> = async (ctx) => {
  + const session = await getSession(ctx)
  +
  + if (session) {
  + ctx.res.statusCode = 302
  + ctx.res.setHeader('Location', routes.index)
  + }
  +
  + return {
  props: {
  - i18nResources: await serverSideTranslations(locale, ['common', 'auth', 'validation']),
  + i18nResources: await serverSideTranslations(ctx.locale, ['common', 'auth', 'validation']),
  providers: await providers(),
  },
  -})
  + }
  +}
  export default LoginPage
  