Skip to content

Commit def2b41

Browse files
committed
🚀 completed Firebase Auth
1 parent 6c20dfe commit def2b41

File tree

7 files changed

+11
-57
lines changed

7 files changed

+11
-57
lines changed

package.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
{
2-
"name": "graphql-react",
2+
"name": "react-firebase",
33
"version": "1.0.0",
4-
"description": "Project to practice the Graphql with react",
4+
"description": "React + Firebase Authentications",
55
"main": "index.js",
66
"scripts": {
77
"dev": "parcel src/index.html --open --port 5050",
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"repository": {
1111
"type": "git",
12-
"url": "git@github.com-junip:junipdewan/graphql-react.git"
12+
"url": "git@github.com-junip:junipdewan/react-firebase.git"
1313
},
14-
"author": "",
15-
"license": "ISC",
14+
"author": "Junip Dewan<junipd2@gmail.com>",
15+
"license": "MIT",
1616
"dependencies": {
17-
"@apollo/react-hooks": "^3.1.5",
18-
"@types/react": "^16.9.35",
19-
"apollo-boost": "^0.4.9",
2017
"firebase": "^7.15.0",
21-
"graphql": "^15.0.0",
2218
"node-sass": "^4.14.1",
2319
"parcel-bundler": "^1.12.4",
2420
"react": "^16.13.1",

src/App.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@ import {
55
Route,
66
} from "react-router-dom";
77

8+
9+
import PrivateRoute from '../src/Routes/PrivateRoute'
10+
import { AuthProvider } from './context/AuthContext'
11+
812
// paths
913
import Login from './components/Login'
1014
import Register from './components/Register'
1115
import AuthenticatedApp from './components/AuthenticatedApp'
1216
import './scss/main.scss'
1317

14-
import PrivateRoute from '../src/Routes/PrivateRoute'
15-
16-
import { AuthProvider } from './context/AuthContext'
17-
18-
// const client = new ApolloClient({
19-
// uri: 'https://countries-274616.ew.r.appspot.com/'
20-
// })
21-
2218
const App = () => {
2319

2420
return (

src/components/AuthenticatedApp.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ const AuthenticatedApp = () => {
99
const logOut = () => {
1010

1111
app.auth().signOut().then((response) => {
12-
console.log(response)
1312
history.push('/login');
1413
}).catch((error) =>{
15-
console.log(error)
14+
console.error(error)
1615
})
1716
}
1817

src/components/Register.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ const Register = () => {
1919
const registerUser = () => {
2020
app.auth().createUserWithEmailAndPassword(email, pass).then((response) => {
2121
if(response) {
22-
console.log("----",response)
2322
history.push('/login')
2423
}
2524
}).catch(function(error) {
26-
// Handle Errors here.
2725
var errorCode = error.code;
2826
var errorMessage = error.message;
29-
// ...
30-
console.log(errorMessage, errorCode);
27+
console.error(errorMessage, errorCode);
3128
})
3229
}
3330

src/components/ShowCountries.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/context/AuthContext.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ export const AuthProvider = ({ children }) => {
1010
app.auth().onAuthStateChanged((user) => {
1111
setPending(true)
1212
if (user) {
13-
console.log("__",user)
1413
setCurrentUser(user)
1514
setPending(false)
1615
} else {
17-
console.log("err",user)
1816
setCurrentUser(null)
1917
setPending(false)
2018
}

src/queries/fetchCountries.js

Whitespace-only changes.

0 commit comments

Comments
 (0)