From c7c25f6b27e3954df00fe1f5531f44d7452abddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=A0=9C=EA=B2=BD?= Date: Tue, 28 Jul 2026 21:58:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EB=B0=B0=ED=8F=AC=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=B6=88=EA=B0=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20auth=20=EB=B0=A9=EC=96=B4=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .env.production 삭제 — GitHub Secret 주입값이 무시되던 문제 해결 - useTokenRefresh: data?.accessToken optional chaining 추가 - useAuthStore: logout 시 isTokenInitialized 초기화 - axiosInstance: reissue 응답 accessToken null 체크 추가 --- .env.production | 1 - src/hooks/auth/useTokenRefresh.ts | 2 +- src/lib/axiosInstance.ts | 3 ++- src/store/useAuthStore.ts | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 .env.production diff --git a/.env.production b/.env.production deleted file mode 100644 index 1580c3af..00000000 --- a/.env.production +++ /dev/null @@ -1 +0,0 @@ -VITE_API_BASE_URL=/ diff --git a/src/hooks/auth/useTokenRefresh.ts b/src/hooks/auth/useTokenRefresh.ts index 5bc4723f..61b8e665 100644 --- a/src/hooks/auth/useTokenRefresh.ts +++ b/src/hooks/auth/useTokenRefresh.ts @@ -19,7 +19,7 @@ export const useTokenRefresh = () => { const initAuth = async () => { try { const { data } = await reissueToken(); - if (data.accessToken) { + if (data?.accessToken) { setAccessToken(data.accessToken); } } catch { diff --git a/src/lib/axiosInstance.ts b/src/lib/axiosInstance.ts index e89a20c0..9e7e631b 100644 --- a/src/lib/axiosInstance.ts +++ b/src/lib/axiosInstance.ts @@ -106,7 +106,8 @@ axiosInstance.interceptors.response.use( try { const { data } = await authInstance.post("/api/auth/reissue"); - const newAccessToken = data.data.accessToken; + const newAccessToken = data.data?.accessToken; + if (!newAccessToken) throw new Error("토큰 재발급 실패"); useAuthStore.getState().setAccessToken(newAccessToken); onRefreshed(newAccessToken); diff --git a/src/store/useAuthStore.ts b/src/store/useAuthStore.ts index cb53d9fd..099682db 100644 --- a/src/store/useAuthStore.ts +++ b/src/store/useAuthStore.ts @@ -31,6 +31,7 @@ const useAuthStore = create((set) => ({ localStorage.removeItem("hasSession"); set({ isLoggedIn: false, + isTokenInitialized: false, accessToken: null, email: "", socialId: null, From 739989ece69c6d7f954bb5dd1c5ea227a4f1f598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=A0=9C=EA=B2=BD?= Date: Tue, 28 Jul 2026 22:12:51 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20CI=20=EB=B9=8C=EB=93=9C=20=EC=8B=9C?= =?UTF-8?q?=20=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=20=EC=A3=BC=EC=9E=85=20?= =?UTF-8?q?=EB=88=84=EB=9D=BD=EC=9C=BC=EB=A1=9C=20Lighthouse=20NO=5FFCP=20?= =?UTF-8?q?=EC=98=A4=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 --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index da4e7dc7..85703c49 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,6 +26,12 @@ jobs: node-version: 20 cache: pnpm + - name: Create .env file + run: | + echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" >> .env + echo "VITE_NAVER_AES_SECRET=${{ secrets.VITE_NAVER_AES_SECRET }}" >> .env + echo "VITE_NAVER_AES_IV=${{ secrets.VITE_NAVER_AES_IV }}" >> .env + - name: Install dependencies run: pnpm install --frozen-lockfile