-
-
Save musaghauri/3717688151c966aea5bcc949b2b4f589 to your computer and use it in GitHub Desktop.
React Auth App - Reset 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 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