blob: 74d259a8fc21b5cf6c3b2f51541547051fef0c74 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
import DesktopView from '@/core/components/views/DesktopView'
import useLogin from '../hooks/useLogin'
import Link from '@/core/components/elements/Link/Link'
import PageContent from '@/lib/content/components/PageContent'
import Alert from '@/core/components/elements/Alert/Alert'
import {useSession, signIn, SignOut} from 'next-auth/react'
const LoginDesktop = () => {
const { handleSubmit, handleChangeInput, isLoading, isValid, alert, emailRef, passwordRef } =
useLogin()
const {data : session } = useSession
console.log('ini google', session)
return (
<DesktopView>
<div className='container mx-auto'>
<div className='grid grid-cols-2 gap-x-10 pt-16'>
<div>
<h1 className='text-2xl font-semibold'>Selamat Datang di Indoteknik</h1>
<h2 className='text-gray_r-11 font-normal mt-1 mb-4'>
Masuk ke akun kamu untuk mulai transaksi!
</h2>
{alert && (
<Alert className='text-center' type={alert.type}>
{alert.children}
</Alert>
)}
<form className='w-full mt-6 flex flex-col gap-y-4' onSubmit={handleSubmit}>
<div>
<label htmlFor='email'>Alamat Email</label>
<input
type='email'
name='email'
id='email'
className='form-input w-full mt-3'
ref={emailRef}
onChange={handleChangeInput}
placeholder='contoh@email.com'
/>
</div>
<div>
<div className='flex justify-between'>
<label htmlFor='password'>Kata Sandi</label>
<Link href='/forgot-password'>Lupa Kata Sandi</Link>
</div>
<input
type='password'
name='password'
id='password'
className='form-input w-full mt-3'
ref={passwordRef}
onChange={handleChangeInput}
placeholder='••••••••••••'
/>
</div>
<button
type='submit'
className='btn-yellow w-full mt-2'
disabled={!isValid || isLoading}
>
{!isLoading ? 'Masuk' : 'Loading...'}
</button>
</form>
<button
type='submit'
className='btn-red w-full mt-2'
onClick={() => signIn()}
>
Masuk dengan google
</button>
<div className='text-gray_r-11 mt-10'>
Belum punya akun Indoteknik?{' '}
<Link href='/register' className='inline'>
Daftar akun baru
</Link>
</div>
</div>
<div>
<PageContent path='/login' />
</div>
</div>
</div>
</DesktopView>
)
}
export default LoginDesktop
|