Skip to content

Commit 9595293

Browse files
authored
Update app.js
1 parent 8dc240d commit 9595293

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/app.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,21 @@ const notesList = document.getElementById("notesList");
66
const loginBtn = document.getElementById("loginBtn");
77
const logoutBtn = document.getElementById("logoutBtn");
88

9-
// Firebase references
10-
const auth = firebase.auth();
11-
const db = firebase.firestore();
12-
13-
// --- Authentication --- //
9+
// --- Auth --- //
1410
loginBtn.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 --- //
2620
auth.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;

0 commit comments

Comments
 (0)