Sha256: 158f99bcc9af1cca934f1d191f15aa1c74c68f326862826b6c6b858ec46dde87
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
jQuery(document).ready(function(){ // Get elements const btnLogin = document.getElementById('login-button'); const btnLogout = document.getElementById('logout-button'); // Add logout event listener btnLogout.addEventListener('click', e=> { firebase.auth().signOut(); }); // Initialize onAuthStateChange initApp = function() { firebase.auth().onAuthStateChanged(function(user) { if (user) { // User is signed in. var displayName = user.displayName; user.getIdToken().then(function(accessToken) { document.getElementById('sign-in-welcome').textContent = welcome; document.getElementById('sign-in-name').textContent = displayName; btnLogin.classList.add('d-none'); btnLogout.classList.remove('d-none'); }); } else { // User is signed out. document.getElementById('sign-in-welcome').textContent = ''; document.getElementById('sign-in-name').textContent = ''; btnLogin.classList.remove('d-none'); btnLogout.classList.add('d-none'); } }, function(error) { console.log(error); }); }; window.addEventListener('load', function() { initApp() }); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-theme-marketing-1.0.1 | assets/js/firebase/firebase-login.js |
jekyll-theme-marketing-1.0.0 | assets/js/firebase/firebase-login.js |