diff options
Diffstat (limited to 'src/lib/auth/components/RegisterMobile.jsx')
| -rw-r--r-- | src/lib/auth/components/RegisterMobile.jsx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/lib/auth/components/RegisterMobile.jsx b/src/lib/auth/components/RegisterMobile.jsx index da6efaf5..c21c9325 100644 --- a/src/lib/auth/components/RegisterMobile.jsx +++ b/src/lib/auth/components/RegisterMobile.jsx @@ -7,6 +7,10 @@ import MobileView from '@/core/components/views/MobileView' import BottomPopup from '@/core/components/elements/Popup/BottomPopup' import PageContent from '@/lib/content/components/PageContent' import ReCAPTCHA from 'react-google-recaptcha' +import { signIn, useSession } from 'next-auth/react' +import { useRouter } from 'next/router' +import { setCookie } from 'cookies-next' +import { useEffect } from 'react' const RegisterMobile = () => { const { @@ -24,6 +28,20 @@ const RegisterMobile = () => { setTnd } = useRegister() + const { data: session } = useSession() + const router = useRouter() + + const handleGoogle = async () => { + await signIn('google', { callbackUrl: '/register' }) + } + + useEffect(() => { + if(session){ + setCookie('auth', JSON.stringify(session?.odooUser)) + router.push('/') + } + },[session]) + return ( <MobileView> <div className='p-6 pt-10 flex flex-col items-center min-h-screen'> @@ -122,6 +140,27 @@ const RegisterMobile = () => { </BottomPopup> </div> + <div className='flex items-center mt-3 mb-3'> + <hr className='flex-1' /> + <p className='text-gray-400'>ATAU</p> + <hr className='flex-1' /> + </div> + + <button + type='submit' + className='border border-gray-500 p-2 rounded-md hover:bg-gray-100 w-full mt-2 flex items-center justify-center gap-x-2' + onClick={() => handleGoogle()} + > + <Image + src='/images/icons8-google.svg' + alt='google image' + className='h-7 w-7' + width={10} + height={10} + /> + <p>Daftar dengan Google</p> + </button> + <div className='text-gray_r-11 mt-4'> Sudah punya akun Indoteknik?{' '} <Link href='/login' className='inline'> |
