Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
codergautam committed Oct 15, 2024
1 parent 52dcdf1 commit 2e19492
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ export default function Home({ }) {
const [options, setOptions] = useState({
});

const login = useGoogleLogin({
let login = null;
if(process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID) {
// eslint-disable-next-line react-hooks/rules-of-hooks
login = useGoogleLogin({
onSuccess: tokenResponse => {
fetch(clientConfig().apiUrl+"/api/googleAuth", {
body: JSON.stringify({ code: tokenResponse.code }),
Expand Down Expand Up @@ -139,7 +142,10 @@ export default function Home({ }) {
flow: "auth-code",

});

if(typeof window !== "undefined") window.login = login;
}



const [isApp, setIsApp] = useState(false);
Expand Down

0 comments on commit 2e19492

Please sign in to comment.