diff --git a/src/component/Contact/Main.js b/src/component/Contact/Main.js index f3f5ba5..3eca3b2 100644 --- a/src/component/Contact/Main.js +++ b/src/component/Contact/Main.js @@ -64,7 +64,9 @@ const Main = ({ brdcum }) => { country: "", }); //initial state values const [countries, setCountries] = useState([]); // initial state for country dropdown + const [myData, setMyData] = useState(null); + // Gave a generic name for multiple calls const API_CALL = new SiteService(); // instantiating the class // API CALL @@ -92,10 +94,10 @@ const Main = ({ brdcum }) => { setMyData(contact); // Checking for errors - if (contact?.data?.status < 1 || contact?.data?.message_id == "") - return (errText.textContent = - "unable to send your message, please try again"); - else { + if (contact?.data?.status < 1 || contact?.data?.message_id == ""){ + errText.textContent = "unable to send your message, please try again"; + response.innerHTML = `
SEND MESSAGE
`; + }else { response.innerHTML = `SEND MESSAGE
`; contact_body.innerHTML = `SEND MESSAGE
`; }); }; @@ -120,6 +120,7 @@ const Main = ({ brdcum }) => { allCountry().then((data) => setCountries(Object.keys(data.data))).catch((err)=>console.log(err.message)); }, []); + // useEffect(() => { // myData // }, [myData]); @@ -222,9 +223,7 @@ const Main = ({ brdcum }) => { value={values.country} onChange={onChange} required> - {countries.length > 0 && @@ -255,7 +254,6 @@ const Main = ({ brdcum }) => { className="form-control" placeholder="Your message" value={values.message} - errorMessage='words have exceeded 350 characters!' onChange={onChange} maxLength={300} pattern="^[A-Za-z0-9]{5, 300}$" @@ -283,7 +281,7 @@ const Main = ({ brdcum }) => {