-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfirebase.js
33 lines (29 loc) · 852 Bytes
/
firebase.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
import { initializeApp } from "firebase/app";
import {
createUserWithEmailAndPassword,
getAuth,
signInWithEmailAndPassword,
} from "firebase/auth";
import { getStorage } from "firebase/storage";
import { getFirestore } from "firebase/firestore";
const firebaseConfig = {
// your firebaseConfig
};
// Initialize Firebase
export const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
export const storage = getStorage(app);
export const db = getFirestore(app);
export function signIn(email, password) {
try {
signInWithEmailAndPassword(auth, email, password).catch((error) => {
console.log("Incorrect Email address or Password");
});
} catch (error) {
alert(error.message);
}
return;
}
export function signUp(email, password) {
return createUserWithEmailAndPassword(auth, email, password);
}