tiny bug fix and checker added

This commit was merged in pull request #458.
This commit is contained in:
2023-10-24 19:09:09 -07:00
parent 2a445fd2d4
commit a2340af314
@@ -7,6 +7,10 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
const [textValue, setTextValue] = useState("");
const [errMsg, setErrMsg] = useState({
market: false,
manage: false,
});
const apiCall = useMemo(() => new usersService(), []);
const handleInputChange = ({ target: { value } }) => {
@@ -50,13 +54,14 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
setMarketMsg({ data: marketMessageRes, state: true });
} catch (error) {
setErrMsg({ market: true });
setMarketMsg({ loading: false, state: false });
throw new Error(error);
} finally {
setTimeout(() => {
setTextValue("");
}, 2000);
setTextValue("");
setTimeout(() => {
setMarketMsg({ loading: false, state: false });
setErrMsg({ market: false });
}, 5000);
}
};
@@ -210,6 +215,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
<div className="relative flex w-full justify-end mt-0 sm:mt-[1.4rem]">
<span className="text-sm text-[#57cd89] absolute left-[8rem] top-4">
{marketMsg.state && "Message Sent!"}
{errMsg.market && "Something went wrong"}
</span>
<button
className="self-end w-[150px] h-[48px] rounded-full text-base bg-yellow-500 text-white"