nss-evening-cohort-10 / nutshell-nautilus-explorer

0 stars 0 forks source link

Auth-create google login #27

Closed aleshakay closed 4 years ago

aleshakay commented 5 years ago

User Story

AC

Dev Notes

aleshakay commented 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 };