You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 21, 2023. It is now read-only.
I don't know if this issue as being raised here before, but i have searched and i haven't seen anything related.
This is my code.
`import { React, useState, useEffect, useRef } from 'react'
import { GoogleLogin } from 'react-google-login'
import usrImg from './usrImg.png'
import viewImg from './view.jpg'
import noViewImg from './noview.png'
import signinwall from './signin-wall.jpg'
const Signin = ({ showNavbar, showNavOpt, sendId, server }) => {
const [passValidated, setPassValidated] = useState(false)
const [signView, setSignView] = useState('Sign in')
const [error, setError] = useState('')
const handleGoogleSuccess = async (googleData) => {
setSignView('hold on...')
console.log('successful')
const res = await fetch('/api/v1/auth/google', {
method: 'POST',
body: JSON.stringify({
token: googleData.tokenId,
}),
headers: {
'Content-Type': 'application/json',
},
})
const data = await res.json()
console.log(data)
const user = data.user
console.log(user)
const res1 = await fetch('/isEmailPresent', {
method: 'POST',
body: JSON.stringify({
schoolEmail: user.email,
}),
headers: {
'Content-Type': 'application/json',
},
})
const resp = await res1.json()
const isPresent = resp.isPresent
if (isPresent) {
const user_id = resp.id
setSignView('Signin in...')
setFields((fields) => {
return { ...fields, id: user_id }
})
setPassValidated(true)
} else {
setPassValidated(false)
setError('This Email is not Authorized, Use Registered School Email!')
setTimeout(() => {
setError('')
}, 5000)
setSignView('Sign in')
}
}
const handleGoogleFailure = async () => {
setPassValidated(false)
setError('No Email To Validate!')
setTimeout(() => {
setError('')
}, 5000)
setSignView('Sign in')
}
return (
<>
<GoogleLogin
clientId='Google client id'
buttonText='Sign in with Google'
onSuccess={handleGoogleSuccess}
onFailure={handleGoogleFailure}
cookiePolicy={'single_host_origin'}
/>
</>
)
}
export default Signin
`
The text was updated successfully, but these errors were encountered: