-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
53 lines (35 loc) · 1.2 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Initialize Firebase
const firebaseConfig = {
apiKey: "AIzaSyChomkFipQOFGb7oSlQcP6hTzDtIvyx-6Y",
authDomain: "web-app-99b47.firebaseapp.com",
databaseURL: "https://web-app-99b47-default-rtdb.firebaseio.com",
projectId: "web-app-99b47",
storageBucket: "web-app-99b47.appspot.com",
messagingSenderId: "371217837115",
appId: "1:371217837115:web:b56954a5cad6ea997e001e"
};
firebase.initializeApp(firebaseConfig);
const reminderAppDB=firebase.database().ref("reminderApp");
document.getElementById("reminderApp").addEventListener("submit",submitForm)
function submitForm(e){
e.preventDefault();
var title=getElementVal('title');
var date=getElementVal('date');
// console.log(title,date);
saveMessages(title,date);
document.querySelector(".alert").style.display="block";
setTimeout(() => {
document.querySelector(".alert").style.display="none";
},3000);
document.getElementById("reminderApp").reset();
}
const saveMessages=(title,date)=>{
var newreminderApp=reminderAppDB.push();
newreminderApp.set({
title : title,
date : date,
});
}
const getElementVal=(id)=>{
return document.getElementById(id).value;
};