Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added google auth #205

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/firebase/auth.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// import { signInWithPopup, GoogleAuthProvider, signOut } from 'firebase/auth';
// import { auth } from './firebase';
import { signInWithPopup, GoogleAuthProvider, signOut } from 'firebase/auth';
import { auth } from './firebase';

// export const signInWithGoogle = async () => {
// const provider = new GoogleAuthProvider();
// try {
// const result = await signInWithPopup(auth, provider);
// const user = result.user;
// return user;
// } catch (error) {
// console.error('Error signing in with Google:', error);
// return false;
// }
// };
export const signInWithGoogle = async () => {
const provider = new GoogleAuthProvider();
try {
const result = await signInWithPopup(auth, provider);
const user = result.user;
return user;
} catch (error) {
console.error('Error signing in with Google:', error);
return false;
}
};

// export const signOutUser = async () => {
// try {
// await signOut(auth);
// return {};
// } catch (error) {
// console.error('Error signing out:', error);
// return false;
// }
// };
export const signOutUser = async () => {
try {
await signOut(auth);
return {};
} catch (error) {
console.error('Error signing out:', error);
return false;
}
};
Loading