File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
import app from 'firebase/app' ;
2
+ import 'firebase/auth' ;
2
3
3
4
const config = {
4
5
apiKey : process . env . REACT_APP_API_KEY ,
@@ -12,7 +13,24 @@ const config = {
12
13
class Firebase {
13
14
constructor ( ) {
14
15
app . initializeApp ( config ) ;
16
+
17
+ this . auth = app . auth ( ) ;
15
18
}
19
+
20
+ // *** Auth API ***
21
+
22
+ doCreateUserWithEmailAndPassword = ( email , password ) =>
23
+ this . auth . createUserWithEmailAndPassword ( email , password ) ;
24
+
25
+ doSignInWithEmailAndPassword = ( email , password ) =>
26
+ this . auth . signInWithEmailAndPassword ( email , password ) ;
27
+
28
+ doSignOut = ( ) => this . auth . signOut ( ) ;
29
+
30
+ doPasswordReset = email => this . auth . sendPasswordResetEmail ( email ) ;
31
+
32
+ doPasswordUpdate = password =>
33
+ this . auth . currentUser . updatePassword ( password ) ;
16
34
}
17
35
18
36
export default Firebase ;
You can’t perform that action at this time.
0 commit comments