Skip to content

Commit

Permalink
Fixed controlled component issue on last_name.
Browse files Browse the repository at this point in the history
* Firebase sending undefined as value.
* Value checked if undefined, reset to empty string.

Fixes #88
  • Loading branch information
praveenscience committed Mar 21, 2020
1 parent 4cb309d commit aa8c2ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Login/signUpFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ export class signUp extends Component {

componentDidMount() {
this.setState({
first_name: firebase.auth().currentUser.displayName.split(" ")[0],
last_name: firebase.auth().currentUser.displayName.split(" ")[1],
first_name: firebase.auth().currentUser.displayName.split(" ")[0]
? firebase.auth().currentUser.displayName.split(" ")[0]
: "",
last_name: firebase.auth().currentUser.displayName.split(" ")[1]
? firebase.auth().currentUser.displayName.split(" ")[1]
: "",
email: firebase.auth().currentUser.email,
})

Expand Down

0 comments on commit aa8c2ea

Please sign in to comment.