-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcreate.js
More file actions
37 lines (31 loc) · 1.3 KB
/
Copy pathcreate.js
File metadata and controls
37 lines (31 loc) · 1.3 KB
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
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.10.0/firebase-app.js";
// import { getDatabase } from "https://www.gstatic.com/firebasejs/10.10.0/firebase-app.database.js";
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/10.10.0/firebase-auth.js";
const firebaseConfig = {
apiKey: "AIzaSyCzuhAjgCdNHJP_ZdOeUTkKhZ9jdLPBmw8",
authDomain: "student-section-12dbb.firebaseapp.com",
projectId: "student-section-12dbb",
storageBucket: "student-section-12dbb.appspot.com",
messagingSenderId: "967191095461",
appId: "1:967191095461:web:f984094f64a49f07e7854c"
};
const app = initializeApp(firebaseConfig);
// const database = getDatabase(app);
const auth = getAuth()
//inputs
const submit = document.getElementById('submit');
submit.addEventListener("click",(event) =>{
event.preventDefault()
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
const user = userCredential.user;
alert("Creating Account...")
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage)
});
})