Last active
January 16, 2018 11:57
-
-
Save musaghauri/df3996b91439199bf5a23d06b8fa57b9 to your computer and use it in GitHub Desktop.
React Auth App - Forgot Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Frontend call for forgot password | |
onForgotPassword = async (data) => { | |
this.setState({ error: false, success: false, loading: true }); | |
const requestBody = { data }; | |
const requestURL = '/api/forgot-password'; | |
const options = createRequestOptions('POST', requestBody); | |
const response = await request(requestURL, options); | |
if(!response.err) { | |
const user = response.data; | |
this.setState({ success: true, loading: false }); | |
} else { | |
this.setState({ error: response.err.reason, loading: false }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment