From 5ed80a8952c5b28b2ed54217c38cc17ac2bc0bef Mon Sep 17 00:00:00 2001 From: dooohun <74540646+dooohun@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:34:10 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20lint=20=EC=97=90=EB=9F=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 사용하지 않는 error 변수의 에러 메시지를 토스트에 추가 - base_url의 논리 연산자 수정 --- packages/client/src/pages/quiz-wait/index.tsx | 5 ++++- packages/client/src/shared/api/index.ts | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/quiz-wait/index.tsx b/packages/client/src/pages/quiz-wait/index.tsx index 857d63be..2da170b6 100644 --- a/packages/client/src/pages/quiz-wait/index.tsx +++ b/packages/client/src/pages/quiz-wait/index.tsx @@ -52,7 +52,10 @@ export default function QuizWait() { navigator.clipboard.writeText(guestLink); toast.success('링크가 복사되었습니다.'); } catch (error) { - toast.error('링크 복사에 실패했습니다.'); + if (error instanceof Error) { + const errorMessage = error.message; + toast.error(errorMessage); + } } }; diff --git a/packages/client/src/shared/api/index.ts b/packages/client/src/shared/api/index.ts index d117c95b..8a0e4efe 100644 --- a/packages/client/src/shared/api/index.ts +++ b/packages/client/src/shared/api/index.ts @@ -1,5 +1,7 @@ // TODO: env 파일로 관리하기 -const BASE_URL = `${import.meta.env.VITE_SERVER_URL}/api` || 'http://localhost:3000/api'; +const BASE_URL = import.meta.env.VITE_SERVER_URL + ? `${import.meta.env.VITE_SERVER_URL}/api` + : 'http://localhost:3000/api'; interface FetchOptions extends Omit { headers?: Record;