Skip to content

Instantly share code, notes, and snippets.

@musaghauri
Last active January 16, 2018 11:54
Show Gist options
  • Save musaghauri/3717688151c966aea5bcc949b2b4f589 to your computer and use it in GitHub Desktop.
Save musaghauri/3717688151c966aea5bcc949b2b4f589 to your computer and use it in GitHub Desktop.
React Auth App - Reset Password
// Frontend call for reset password
onResetPassword = async (data) => {
this.setState({ error: false, loading: true });
const requestBody = { data };
const requestURL = '/api/reset-password';
const options = createRequestOptions('POST', requestBody);
const response = await request(requestURL, options);
if(!response.err) {
const user = response.data;
this.setState({ loading: false })
Router.push("/");
} 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