import React, { useState, useEffect, useContext } from 'react'; import '../App.css'; import './Reset.css'; import { Button } from 'reactstrap'; import { Formik, Form, Field } from 'formik'; import ScaleLoader from 'react-spinners/ScaleLoader'; import { validateResetPassword, sendPasswordReset } from '../Api/index'; import AuthContext from '../Contexts/AuthContext'; const Reset = (route) => { let boolTrue = true; const [loading, setLoading] = useState(true); const [reset, setReset] = useState({}); const [sent, setSent] = useState(false); let { ResetPassword } = useContext(AuthContext); let reqToken = false; if (route && route.match && route.match.params && route.match.params.token) { reqToken = route.match.params.token } const sendReset = (values) => { sendPasswordReset(values).then(() => { setSent(true); }); } useEffect(() => { if (!reqToken) { setLoading(false); return false; } validateResetPassword(reqToken) .then(data => { setReset(data); console.log(data) setLoading(false); }) }, [reqToken]) if (loading) { return (