Closed aleshakay closed 4 years ago
I had to move functions to ensure they executed
import $ from 'jquery'; import firebase from 'firebase/app'; import 'firebase/auth';
const signMeIn = () => { $('body').on('click', '#navbar-button-login', (e) => { e.preventDefault(); const provider = new firebase.auth.GoogleAuthProvider(); firebase.auth().signInWithPopup(provider); }); };
export default { signMeIn };
const logoutEvent = () => { $('body').on('click', '#navbar-button-logout', (e) => { e.preventDefault(); firebase.auth().signOut() .then(() => { login.checkLoginStatus(); }).catch((err) => console.error('you still logged in', err)); }); };
export default { logoutEvent };
User Story
AC
Dev Notes
In firebase, enable google authentication
Add an authdata.js
import firebase/app and firebase/auth
create a function checkLoginStatus
export checkLoginStatus
create component auth.js
import bootstrap button for auth
create signin function
const signMeIn = () => { const provider = new firebase.auth.GoogleAuthProvider(); firebase.auth().signInWithPopup(provider); };
create a function for the login button and event listener
const loginButton = () => { const domString = `<button id="google-auth"> </button>`; utilities.printToDom('auth', domString); $('#google-auth').click(signMeIn); };
export default { loginButton };