Comparing version 0.0.23 to 0.0.24
@@ -27,3 +27,3 @@ { | ||
"private": false, | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"type": "module", | ||
@@ -30,0 +30,0 @@ "files": [ |
@@ -44,2 +44,4 @@ ### OAuthify | ||
} from 'oauthify'; | ||
import { useAuth } from './contexts/Auth.context'; | ||
const googleClientId = 'xxxxxxxxx'; | ||
@@ -49,12 +51,2 @@ const githubClientId = 'XXXXXXXX'; | ||
const App = () => { | ||
const handleSuccess = (response) => { | ||
console.log('Google login success:', response); | ||
// Handle successful login, e.g., set user info in app state | ||
}; | ||
const handleFailure = (error) => { | ||
console.error('Google login failure:', error); | ||
// Handle failed login, e.g., show error message to user | ||
}; | ||
return ( | ||
@@ -71,11 +63,22 @@ <OAuthifyProvider> | ||
const LoginComponent = () => { | ||
const { onSuccess, onFailure, setOnSuccess } = useOAuthify(); | ||
const handleSuccess = () => { | ||
// Handle the success state of LoginWithGoogle or LoginWithGithub | ||
}; | ||
const handleFailure = () => { | ||
// Handle the success state of LoginWithGoogle or LoginWithGithub | ||
}; | ||
React.useEffect(() => { | ||
handleSuccess(); | ||
}, [onSuccess]); | ||
React.useEffect(() => { | ||
handleFailure(); | ||
}, [onFailure]); | ||
return ( | ||
<> | ||
<div className="flex flex-row justify-center items-center my-6 space-x-2"> | ||
<GoogleLoginButton | ||
clientId={googleClientId} | ||
redirectUri={redirectUri} | ||
onSuccess={handleSuccess} | ||
onFailure={handleFailure} | ||
> | ||
<GoogleLoginButton clientId={googleClientId} redirectUri={redirectUri}> | ||
<div | ||
@@ -101,8 +104,3 @@ style={{ | ||
<GitHubLoginButton | ||
clientId={githubClientId} | ||
redirectUri={redirectUri} | ||
onSuccess={handleSuccess} | ||
onFailure={handleFailure} | ||
> | ||
<GitHubLoginButton clientId={githubClientId} redirectUri={redirectUri}> | ||
> | ||
@@ -109,0 +107,0 @@ <div |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32364
241