From 522de2d2f04070aa81837ece563874b3b0540559 Mon Sep 17 00:00:00 2001 From: Hyo Bin Date: Wed, 24 Jul 2024 11:43:58 +0900 Subject: [PATCH] =?UTF-8?q?fix:#146-=EB=82=98=EC=9D=98=20=EA=B1=B0?= =?UTF-8?q?=EB=9E=98/=EA=B2=BD=EB=A7=A4=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=9E=91=EB=8F=99=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MyAuctionList.jsx | 47 +++++++++++++++++++++++++++--------- src/pages/MyTradeList.jsx | 48 ++++++++++++++++++++++++++++--------- 2 files changed, 73 insertions(+), 22 deletions(-) diff --git a/src/pages/MyAuctionList.jsx b/src/pages/MyAuctionList.jsx index 236a3f4..7984948 100644 --- a/src/pages/MyAuctionList.jsx +++ b/src/pages/MyAuctionList.jsx @@ -30,23 +30,48 @@ const MyAuctionList = () => { const navigate = useNavigate(); const { t } = useTranslation(); + // useEffect(() => { + // const fetchAllData = async () => { + // await handleDoneAuction(); + // await handleOnAuction(); + // }; + // fetchAllData(); + // if (mySellListOpen) { + // if (onSale) { + // handleOnAuction(); + // } else { + // handleDoneAuction(); + // } + // } else if (myBuyListOpen) { + // handleMyBuyListOpen(); + // } + // }, [pageBuy, pageOngoing, pageClose]); useEffect(() => { const fetchAllData = async () => { - await handleDoneAuction(); - await handleOnAuction(); + if (mySellListOpen) { + await handleDoneAuction(); + } else if (myBuyListOpen) { + await handleMyBuyListOpen(); + } }; + fetchAllData(); - if (mySellListOpen) { - if (onSale) { - handleOnAuction(); - } else { - handleDoneAuction(); + }, []); + useEffect(() => { + const fetchAllData = async () => { + if (mySellListOpen) { + if (onSale) { + await handleOnAuction(); + } else { + await handleDoneAuction(); + } + } else if (myBuyListOpen) { + await handleMyBuyListOpen(); } - } else if (myBuyListOpen) { - handleMyBuyListOpen(); - } - }, [pageBuy, pageOngoing, pageClose]); + }; + fetchAllData(); + }, [pageBuy, pageOngoing, pageClose, mySellListOpen, myBuyListOpen, onSale]); const handleMySellListOpen = async () => { setMySellListOpen(true); setMyBuyListOpen(false); diff --git a/src/pages/MyTradeList.jsx b/src/pages/MyTradeList.jsx index 8259f94..0341d7f 100644 --- a/src/pages/MyTradeList.jsx +++ b/src/pages/MyTradeList.jsx @@ -34,22 +34,48 @@ const MyTradeList = () => { const navigate = useNavigate(); + // useEffect(() => { + // const fetchAllData = async () => { + // await handleDoneSale(); + // await handleOnSale(); + // }; + // fetchAllData(); + // if (mySellListOpen) { + // if (onSale) { + // handleOnSale(); + // } else { + // handleDoneSale(); + // } + // } else if (myBuyListOpen) { + // handleMyBuyListOpen(); + // } + // }, [pageBuy, pageOngoing, pageClose]); useEffect(() => { const fetchAllData = async () => { - await handleDoneSale(); - await handleOnSale(); + if (mySellListOpen) { + await handleDoneSale(); + } else if (myBuyListOpen) { + await handleMyBuyListOpen(); + } }; + fetchAllData(); - if (mySellListOpen) { - if (onSale) { - handleOnSale(); - } else { - handleDoneSale(); + }, []); + useEffect(() => { + const fetchAllData = async () => { + if (mySellListOpen) { + if (onSale) { + await handleOnSale(); + } else { + await handleDoneSale(); + } + } else if (myBuyListOpen) { + await handleMyBuyListOpen(); } - } else if (myBuyListOpen) { - handleMyBuyListOpen(); - } - }, [pageBuy, pageOngoing, pageClose]); + }; + + fetchAllData(); + }, [pageBuy, pageOngoing, pageClose, mySellListOpen, myBuyListOpen, onSale]); const handleMySellListOpen = async () => { setMySellListOpen(true);