summaryrefslogtreecommitdiff
path: root/src/pages/login.jsx
blob: 07d1378443001af79d51f8bb76f70591179adb34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import Seo from '@/core/components/Seo';
import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter';
import BasicLayout from '@/core/components/layouts/BasicLayout';
import DesktopView from '@/core/components/views/DesktopView';
import MobileView from '@/core/components/views/MobileView';
import LoginComponent from '@/lib/auth/components/Login';
import AccountActivation from '~/modules/account-activation';
import useAuth from '@/core/hooks/useAuth';

export default function Login() {
  const router = useRouter();
  const auth = useAuth();

  useEffect(() => {
    if (auth) {
      router.push('/');
    }
  }, [auth, router]);

  return (
    <>
      <Seo title='Login - Indoteknik.com' />

      <DesktopView>
        <BasicLayout>
          <LoginComponent />
        </BasicLayout>
      </DesktopView>

      <MobileView>
        <LoginComponent />
        <SimpleFooter />
      </MobileView>

      <AccountActivation />
    </>
  );
}