Skip to content

Commit 7a3a2b5

Browse files
finishing sign in handle submit method and storing user data in firestore
1 parent c34bd12 commit 7a3a2b5

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/App.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class App extends Component {
2727
id: snapshot.id,
2828
...snapshot.data()
2929
}
30-
}, ()=> {
31-
console.log(this.state)
3230
})
3331
})
3432
}

src/components/sign-in/sign-in.component.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Component } from 'react'
22
import './sign-in.styles.scss'
33
import FormInput from '../form-input/form-input.component'
44
import CustomButton from '../custom-button/custom-button.component'
5-
import { signInWithGoogle } from '../../firebase/firebase.utils'
5+
import { signInWithGoogle, auth } from '../../firebase/firebase.utils'
66
export default class signIn extends Component {
77
constructor(props) {
88
super(props)
@@ -12,8 +12,17 @@ export default class signIn extends Component {
1212
password: '',
1313
}
1414
}
15-
handleSubmit = e => {
15+
handleSubmit = async e => {
1616
e.preventDefault()
17+
const { email, password } = this.state
18+
try {
19+
await auth.signInWithEmailAndPassword(email, password)
20+
this.setState({ email: '', password: '' })
21+
} catch (error) {
22+
console.log(error)
23+
}
24+
25+
1726
this.setState({ email: "", password: "" })
1827
}
1928
handleChange = e => {

src/components/sign-up/sign-up.component.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { Component } from 'react'
22
import FormInput from '../form-input/form-input.component'
3-
import customButton from '../custom-button/custom-button.component'
43
import { auth, createUserProfileDocument } from '../../firebase/firebase.utils'
54
import './sign-up.styles.scss'
65
import CustomButton from '../custom-button/custom-button.component'

0 commit comments

Comments
 (0)