forked from PompolutZ/react-firebase-auth-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleh Lutsenko
committed
May 6, 2019
1 parent
1cdf5c7
commit 19c9915
Showing
7 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "exopen-c2af4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"rules": { | ||
".read": true, | ||
".write": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"database": { | ||
"rules": "database.rules.json" | ||
}, | ||
"hosting": { | ||
"public": "build", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.*", | ||
"**/node_modules/**" | ||
], | ||
"rewrites": [ | ||
{ | ||
"source": "**", | ||
"destination": "/index.html" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
|
||
const FirebaseContext = React.createContext(null); | ||
|
||
export const withFirebase = Component => props => ( | ||
<FirebaseContext.Consumer> | ||
{ firebase => <Component {...props} firebase={firebase} />} | ||
</FirebaseContext.Consumer> | ||
); | ||
|
||
export default FirebaseContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import app from 'firebase/app'; | ||
import 'firebase/database'; | ||
|
||
const config = { | ||
apiKey: "AIzaSyCvwmNhhs-1PEF9Qk1gOYNpp-m65-0JJNY", | ||
authDomain: "exopen-c2af4.firebaseapp.com", | ||
databaseURL: "https://exopen-c2af4.firebaseio.com", | ||
projectId: "exopen-c2af4", | ||
storageBucket: "exopen-c2af4.appspot.com", | ||
messagingSenderId: "1003479661787" | ||
}; | ||
|
||
class Firebase { | ||
constructor() { | ||
app.initializeApp(config); | ||
|
||
this.db = app.database(); | ||
this.auth = app.auth(); | ||
} | ||
|
||
// *** Auth API *** | ||
createUserWithEmailAndPassword = (email, password) => | ||
this.auth.createUserWithEmailAndPassword(email, password); | ||
|
||
signInWithEmailAndPassword = (email, password) => | ||
this.auth.signInWithEmailAndPassword(email, password); | ||
|
||
signOut = () => this.auth.signOut(); | ||
|
||
sendPasswordResetEmail = email => this.auth.sendPasswordResetEmail(email); | ||
|
||
updatePassword = password => this.auth.currentUser.updatePassword(password); | ||
} | ||
|
||
export default Firebase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Firebase from './firebase'; | ||
import FirebaseContext from './context'; | ||
|
||
export default Firebase; | ||
|
||
export { FirebaseContext }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters