* Handles the sign in button press.
()
| 30 | * Handles the sign in button press. |
| 31 | */ |
| 32 | function toggleSignIn() { |
| 33 | if (auth.currentUser) { |
| 34 | signOut(auth); |
| 35 | } else { |
| 36 | signInAnonymously(auth).catch(function (error) { |
| 37 | // Handle Errors here. |
| 38 | const errorCode = error.code; |
| 39 | const errorMessage = error.message; |
| 40 | if (errorCode === 'auth/operation-not-allowed') { |
| 41 | alert('You must enable Anonymous auth in the Firebase Console.'); |
| 42 | } else { |
| 43 | console.error(error); |
| 44 | } |
| 45 | }); |
| 46 | } |
| 47 | signInButton.disabled = true; |
| 48 | } |
| 49 | |
| 50 | // Listening for auth state changes. |
| 51 | onAuthStateChanged(auth, function (user) { |
nothing calls this directly
no outgoing calls
no test coverage detected