import { useState } from "react"; import { Form, Grid, Segment, Button, Message, Icon } from "semantic-ui-react"; import { sendResetPassword } from "../features/user/userSlice"; import { Link } from "react-router-dom"; import { useDispatch } from 'react-redux' const SendResetPassword = () => { const dispatch = useDispatch(); const [checkInputMessages, setCheckInputMessages] = useState(""); const [email, setEmail] = useState(""); const [emailError, setEmailError] = useState(false); const [resetSent, setResetSent] = useState(false); const returnStyle = { marginTop: "30px" }; const handleSendResetPassword = async () => { if (email === "") { setEmailError(true); setCheckInputMessages("Email is required"); } else { const result = await dispatch(sendResetPassword({ email })).unwrap(); if (result.success) { setResetSent(true); setEmailError(true); } else { setCheckInputMessages(result.message); console.error(result); } } }; var resetMessage = ""; if (checkInputMessages.length) { resetMessage = ( Problems... {checkInputMessages} ); } return ( {!resetSent ? (

Forgot your password?

Enter the email address for your account. setEmail(e.target.value)} value={email} error={emailError} label="Email" placeholder="Email..." />
) : (

Reset Link Sent

An email with a link to reset your password was sent to: {email}
Back to OpenMHz
)}
); } export default SendResetPassword;