From 0b147f64347922dc9cd37b179b259370860e03fb Mon Sep 17 00:00:00 2001 From: yunseok Date: Tue, 6 Aug 2024 02:51:38 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EB=8B=A4=EB=A5=B8=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=A5=20=EB=B0=A9=EB=AC=B8=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=20?= =?UTF-8?q?=EC=95=88=EB=9C=A8=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MarketPage.js | 9 +++++++-- src/utils/OrderRequest.js | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/pages/MarketPage.js b/src/pages/MarketPage.js index 398ced9..4abdf0d 100644 --- a/src/pages/MarketPage.js +++ b/src/pages/MarketPage.js @@ -61,8 +61,13 @@ const MarketPage = () => { return; } else { const dates = Object.keys(res.data.payload); - setVisitList(res.data.payload[dates[0]]); - const num = res.data.payload[dates[0]].length; + const totalVisitList = res.data.payload[dates[0]]; + const marketVisitList = totalVisitList.filter( + (visit) => + visit.marketId.toString() === marketId.toString() + ); + setVisitList(marketVisitList); + const num = marketVisitList.length; setVisitNum(num); } }) diff --git a/src/utils/OrderRequest.js b/src/utils/OrderRequest.js index 47ce855..dbe35c4 100644 --- a/src/utils/OrderRequest.js +++ b/src/utils/OrderRequest.js @@ -1,8 +1,10 @@ +import ButtonModal from "components/Common/ButtonModal"; import Splash from "components/Common/Splash"; import useOrderStore from "hooks/useOrderStore"; import useSyluvAxios from "hooks/useSyluvAxios"; import OrderResult from "pages/OrderResult"; import { useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; const OrderRequest = () => { const { getGlobalOrderData } = useOrderStore(); @@ -10,6 +12,8 @@ const OrderRequest = () => { const [data, setData] = useState(null); const [result, setResult] = useState(null); const [isLoading, setIsLoading] = useState(true); + const [isError, setIsError] = useState(false); + const navigate = useNavigate(); useEffect(() => { setData(getGlobalOrderData()); @@ -31,6 +35,10 @@ const OrderRequest = () => { .then((res) => { setResult(res.data.payload); setIsLoading(false); + }) + .catch(() => { + setIsError(true); + setIsLoading(false); }); } }, [data]); @@ -39,6 +47,19 @@ const OrderRequest = () => { return ; } + if (isError) { + return ( + navigate("/")} + right="장바구니로 이동" + onRightClick={() => navigate("/cart")} + /> + ); + } + return ; }; export default OrderRequest; From 85814ecd6b84dba21ff107ebe0bcfb3389614053 Mon Sep 17 00:00:00 2001 From: yunseok Date: Tue, 6 Aug 2024 02:52:57 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EC=82=AC=EC=9E=A5=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Login/Welcome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Login/Welcome.js b/src/components/Login/Welcome.js index e4339f3..f3e4c29 100644 --- a/src/components/Login/Welcome.js +++ b/src/components/Login/Welcome.js @@ -24,7 +24,7 @@ const Welcome = () => {