Skip to content

Instantly share code, notes, and snippets.

@musaghauri
Last active January 16, 2018 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musaghauri/df3996b91439199bf5a23d06b8fa57b9 to your computer and use it in GitHub Desktop.
Save musaghauri/df3996b91439199bf5a23d06b8fa57b9 to your computer and use it in GitHub Desktop.
React Auth App - Forgot Password
// 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