diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-09-01 02:34:28 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-09-01 02:34:28 +0000 |
| commit | da727c41d5221e13389005dbdff2706d3eb42842 (patch) | |
| tree | 2abb9a8090306791a76069baff6c91c5e151d3b5 /src/lib/auth/components/RegisterDesktop.jsx | |
| parent | 7356bcc0d1b7bac8d05ac315fdcf2a46b3996e91 (diff) | |
| parent | dfdeedf7141c9191952bdb3005e2e91d2a495044 (diff) | |
Merged in Feature/google_sign_up (pull request #56)
Feature/google sign up
Diffstat (limited to 'src/lib/auth/components/RegisterDesktop.jsx')
| -rw-r--r-- | src/lib/auth/components/RegisterDesktop.jsx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/lib/auth/components/RegisterDesktop.jsx b/src/lib/auth/components/RegisterDesktop.jsx index 93b505ab..a2bc98c2 100644 --- a/src/lib/auth/components/RegisterDesktop.jsx +++ b/src/lib/auth/components/RegisterDesktop.jsx @@ -5,6 +5,12 @@ import Alert from '@/core/components/elements/Alert/Alert' import PageContent from '@/lib/content/components/PageContent' import BottomPopup from '@/core/components/elements/Popup/BottomPopup' import ReCAPTCHA from 'react-google-recaptcha' +import Image from 'next/image' +import { useEffect } from 'react' +import { setCookie } from 'cookies-next' +import { signIn, useSession } from 'next-auth/react' +import { useRouter } from 'next/router' +import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' const RegisterDesktop = () => { const { @@ -21,6 +27,31 @@ const RegisterDesktop = () => { tnd, setTnd } = useRegister() + + const { data: session } = useSession() + const router = useRouter() + + const handleGoogle = async () => { + await signIn('google', { callbackUrl: '/register?source=google' }) + } + + useEffect(() => { + if(session){ + setCookie('auth', JSON.stringify(session?.odooUser)) + router.push('/') + } + },[session]) + + if (router.query.source) { + return ( + <BottomPopup active={true} close=''> + <div className='leading-7 text-gray_r-12/80 flex justify-center'>Mohon Tunggu</div> + <div className='container flex justify-center my-4'> + <LogoSpinner width={48} height={48} /> + </div> + </BottomPopup> + ) + } return ( <DesktopView> @@ -121,6 +152,26 @@ const RegisterDesktop = () => { <PageContent path='/register#tnd'></PageContent> </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-10'> Sudah punya akun Indoteknik?{' '} |
