From f30e3cc52374fd5f08ca61b4fe3241c35a4317d3 Mon Sep 17 00:00:00 2001 From: jhj2713 Date: Mon, 12 Aug 2024 17:26:57 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20useFetch=20hook=20state=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/hooks/useFetch.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/hooks/useFetch.ts b/client/src/hooks/useFetch.ts index fa04daa7..2be29137 100644 --- a/client/src/hooks/useFetch.ts +++ b/client/src/hooks/useFetch.ts @@ -9,6 +9,9 @@ export default function useFetch(fetch: (params: P) => Promise) const { showBoundary } = useErrorBoundary(); const fetchData = async (params?: P) => { + setIsError(false); + setIsSuccess(false); + try { const data = await fetch(params as P); setData(data); From 5dd9e24d5af9d39e094f0bd3aaa6982e2c8625ec Mon Sep 17 00:00:00 2001 From: jhj2713 Date: Mon, 12 Aug 2024 17:34:07 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EB=A0=8C=EB=8D=94=EB=A7=81=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EB=B0=9C=EC=83=9D=20=EC=8B=9C=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=EA=B3=A0=EC=B9=A8=20=EB=B0=9C=EC=83=9D=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/ErrorElement/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/pages/ErrorElement/index.tsx b/client/src/pages/ErrorElement/index.tsx index dd867ee3..d89e5a90 100644 --- a/client/src/pages/ErrorElement/index.tsx +++ b/client/src/pages/ErrorElement/index.tsx @@ -5,6 +5,10 @@ interface ErrorElementProps { } export default function ErrorElement({ fallbackUrl = "/" }: ErrorElementProps) { + const handleClickButton = () => { + window.location.href = fallbackUrl; + }; + return (
오류 아이콘 @@ -13,7 +17,7 @@ export default function ErrorElement({ fallbackUrl = "/" }: ErrorElementProps) { 문제가 발생했습니다. 잠시 후 다시 시도해 보세요.
- +
); } From e80cedaf933d0bdc132b0593d66a23bb1e33bab2 Mon Sep 17 00:00:00 2001 From: jhj2713 Date: Mon, 12 Aug 2024 17:56:34 +0900 Subject: [PATCH 3/3] fix: referrerId -> referralId --- client/src/constants/cookie.ts | 2 +- client/src/features/CasperCustom/CasperCustomForm.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/constants/cookie.ts b/client/src/constants/cookie.ts index 7b427b53..c359e9aa 100644 --- a/client/src/constants/cookie.ts +++ b/client/src/constants/cookie.ts @@ -1,4 +1,4 @@ export const COOKIE_KEY = { ACCESS_TOKEN: "token", - INVITE_USER: "referrerId", + INVITE_USER: "referralId", } as const; diff --git a/client/src/features/CasperCustom/CasperCustomForm.tsx b/client/src/features/CasperCustom/CasperCustomForm.tsx index fd15a037..0465f00a 100644 --- a/client/src/features/CasperCustom/CasperCustomForm.tsx +++ b/client/src/features/CasperCustom/CasperCustomForm.tsx @@ -28,9 +28,9 @@ export function CasperCustomForm({ navigateNextStep }: CasperCustomFormProps) { fetchData: postCasper, } = useFetch< PostCasperResponse, - { token: string; referrerId: string; casper: CasperInformationType } - >(({ token, referrerId, casper }) => - LotteryAPI.postCasper(token, { ...casper, [COOKIE_KEY.INVITE_USER]: referrerId }) + { token: string; referralId: string; casper: CasperInformationType } + >(({ token, referralId, casper }) => + LotteryAPI.postCasper(token, { ...casper, [COOKIE_KEY.INVITE_USER]: referralId }) ); const { casperName, expectations, selectedCasperIdx } = useCasperCustomStateContext(); @@ -85,7 +85,7 @@ export function CasperCustomForm({ navigateNextStep }: CasperCustomFormProps) { await postCasper({ token: cookies[COOKIE_KEY.ACCESS_TOKEN], - referrerId: cookies[COOKIE_KEY.INVITE_USER], + referralId: cookies[COOKIE_KEY.INVITE_USER], casper, }); };