-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
18,272 additions
and
231 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +0,0 @@ | ||
import React from "react"; | ||
import { useSignInWithGoogle } from "react-firebase-hooks/auth"; | ||
import toast from "react-hot-toast"; | ||
import { useNavigate } from "react-router-dom"; | ||
import auth from "../../firebase.init"; | ||
import Loading from "../Loading/Loading"; | ||
|
||
const GoogleAuth = () => { | ||
const [signInWithGoogle, user, loading, error] = useSignInWithGoogle(auth); | ||
const navigate = useNavigate(); | ||
|
||
if (loading) { | ||
return <Loading />; | ||
} | ||
if (user) { | ||
return navigate("/home"); | ||
} | ||
|
||
return ( | ||
<> | ||
<button | ||
onClick={() => signInWithGoogle()} | ||
className="btn btn-outline w-[300px] my-2" | ||
> | ||
Continue with Google | ||
</button> | ||
{error && toast.error(error.message, { id: "gError" })} | ||
</> | ||
); | ||
}; | ||
|
||
export default GoogleAuth; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
// Import the functions you need from the SDKs you need | ||
import { initializeApp } from "firebase/app"; | ||
import { getAuth } from "firebase/auth"; | ||
|
||
// TODO: Add SDKs for Firebase products that you want to use | ||
// https://firebase.google.com/docs/web/setup#available-libraries | ||
|
||
// Your web app's Firebase configuration | ||
const firebaseConfig = { | ||
apiKey: process.env.REACT_APP_apiKey, | ||
authDomain: process.env.REACT_APP_authDomain, | ||
projectId: process.env.REACT_APP_projectId, | ||
storageBucket: process.env.REACT_APP_storageBucket, | ||
messagingSenderId: process.env.REACT_APP_messagingSenderId, | ||
appId: process.env.REACT_APP_appId, | ||
apiKey: "AIzaSyD2k-5PmGq_u2XZEf9DcRbnxX2S6FhMSsk", | ||
authDomain: "learnwithrumon.firebaseapp.com", | ||
projectId: "learnwithrumon", | ||
storageBucket: "learnwithrumon.appspot.com", | ||
messagingSenderId: "314388553216", | ||
appId: "1:314388553216:web:a78efe3815a715753202e5", | ||
}; | ||
|
||
// Initialize Firebase | ||
const app = initializeApp(firebaseConfig); | ||
|
||
const auth = getAuth(app); | ||
|
||
export default auth; |