From a2340af314ad1b3f0377cbb6bac7c65e7b39e6eb Mon Sep 17 00:00:00 2001 From: Chief Bube Date: Tue, 24 Oct 2023 19:09:09 -0700 Subject: [PATCH] tiny bug fix and checker added --- src/components/MarketPlace/PopUp/MarketPopUp.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/MarketPlace/PopUp/MarketPopUp.jsx b/src/components/MarketPlace/PopUp/MarketPopUp.jsx index 4be1f6e..1f3bc7b 100644 --- a/src/components/MarketPlace/PopUp/MarketPopUp.jsx +++ b/src/components/MarketPlace/PopUp/MarketPopUp.jsx @@ -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 }) => {
{marketMsg.state && "Message Sent!"} + {errMsg.market && "Something went wrong"}