-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
Merging, no need of review. Focus on #1
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# next | ||
.next |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from "react"; | ||
import Firebase from "./firebase"; | ||
|
||
const FirebaseContext = React.createContext(new Firebase()); | ||
|
||
export default FirebaseContext; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import firebase from "firebase"; | ||
import "firebase/auth"; | ||
|
||
var config = { | ||
apiKey: process.env.NEXT_PUBLIC_API_KEY, | ||
authDomain: process.env.NEXT_PUBLIC_AUTH_DOMAIN, | ||
databaseURL: process.env.NEXT_PUBLIC_DATABASE_URL, | ||
projectId: process.env.NEXT_PUBLIC_PROJECT_ID, | ||
storageBucket: process.env.NEXT_PUBLIC_STORAGE_BUCKET, | ||
messagingSenderId: process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID, | ||
appId: process.env.NEXT_PUBLIC_APP_ID, | ||
}; | ||
|
||
class Firebase { | ||
constructor() { | ||
if (!firebase.apps.length) { | ||
firebase.initializeApp(config); | ||
} | ||
} | ||
|
||
createUser = (email, password) => | ||
firebase.auth().createUserWithEmailAndPassword(email, password); | ||
|
||
verifyUser = (userCredential) => { | ||
userCredential.user | ||
.sendEmailVerification() | ||
.then(function () { | ||
console.log("Verification Email sent"); | ||
}) | ||
.catch(function (error) { | ||
console.error("Error sending verification email: ", error); | ||
}); | ||
}; | ||
|
||
signInUser = (email, password) => | ||
firebase.auth().signInWithEmailAndPassword(email, password); | ||
|
||
handleVerifyEmail = (actionCode) => | ||
firebase.auth().applyActionCode(actionCode); | ||
} | ||
|
||
export default Firebase; |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.