File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -6,28 +6,21 @@ const notesList = document.getElementById("notesList");
66const loginBtn = document . getElementById ( "loginBtn" ) ;
77const logoutBtn = document . getElementById ( "logoutBtn" ) ;
88
9- // Firebase references
10- const auth = firebase . auth ( ) ;
11- const db = firebase . firestore ( ) ;
12-
13- // --- Authentication --- //
9+ // --- Auth --- //
1410loginBtn . addEventListener ( "click" , ( ) => {
1511 const email = prompt ( "Email:" ) ;
1612 const password = prompt ( "Password:" ) ;
1713 auth . signInWithEmailAndPassword ( email , password )
1814 . catch ( err => alert ( err . message ) ) ;
1915} ) ;
2016
21- logoutBtn . addEventListener ( "click" , ( ) => {
22- auth . signOut ( ) ;
23- } ) ;
17+ logoutBtn . addEventListener ( "click" , ( ) => auth . signOut ( ) ) ;
2418
2519// --- Listen for auth changes --- //
2620auth . onAuthStateChanged ( user => {
2721 if ( user ) {
28- notesList . innerHTML = "" ;
29- listenNotes ( user . uid ) ;
3022 addNoteBtn . disabled = false ;
23+ listenNotes ( user . uid ) ;
3124 } else {
3225 notesList . innerHTML = "<p>Please log in to see your notes.</p>" ;
3326 addNoteBtn . disabled = true ;
You can’t perform that action at this time.
0 commit comments