-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (37 loc) · 1.04 KB
/
index.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
function makeAccount() {
email = document.getElementById('inputEmail').value
password = document.getElementById('inputPassword').value
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
alert(errorCode);
alert(errorMessage);
// ...
});
var db = firebase.firestore();
var blank = []
db.collection("users").doc(email).set({
partsUsing: blank
})
};
function signInAccount() {
email = document.getElementById('inputEmail').value
password = document.getElementById('inputPassword').value
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
};
window.onload = function() {
console.log("loaded");
}
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
console.log("signing in")
document.location.href = "main.html";
} else {
}
});