import React, { Component } from "react"; import { Button, Form, Grid, Header, Image, Icon, Message, } from "semantic-ui-react"; import { Redirect } from "react-router-dom"; import { call } from "../client_server"; export default class ForgotPass extends Component { constructor(props) { super(props); this.state = { user: "", error: { state: false, message: "", }, success: false, }; } onChangeHandler = (event) => { let nam = event.target.name; let val = event.target.value; this.setState({ [nam]: val }); }; handleSendEmail = (e) => { e.preventDefault(); const params = { email: this.state.user, }; call .initResetPassword(params) .then((res) => { console.log(res); if (res.status === 200) { this.setState({ success: true }); } if (res.status === "Errore") { this.setState({ error: { state: true, message: "Errore" } }); } //set a message that an email has been sent }) .catch((err) => { console.log(err); }); }; render() { if (this.state.success) { return ; } return (
Reset Password
); } }