Guest User

Untitled

a guest
Jan 24th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. handleResetPassword = () => {
  2. const { email } = this.state
  3. this.context.auth
  4. .sendPasswordResetEmail(email)
  5. .then(() => {
  6. console.warn('Email is sent')
  7. this.setState({
  8. ...this.state,
  9. type: 'success',
  10. header: 'Email is sent',
  11. errorMessage:
  12. 'Please check your email in order to change the password',
  13. password: ''
  14. })
  15. })
  16. .catch(error => {
  17. const { message } = error
  18. const errorMessage = !email ? 'Please enter an email address' : message
  19. this.setState({
  20. ...this.state,
  21. type: 'error',
  22. header: 'Email is not sent',
  23. errorMessage: errorMessage
  24. })
  25. })
Add Comment
Please, Sign In to add comment