From 2dbd44a6212aa9c74dd0b8de1305e749bc11651f Mon Sep 17 00:00:00 2001 From: lee-hyeon-cheol Date: Wed, 16 Sep 2026 21:24:17 +0900 Subject: [PATCH] =?UTF-8?q?chore(frontend):=20=EA=B0=9C=EB=B0=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=EC=97=90=EC=84=9C=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=ED=8F=BC=20=EA=B8=B0=EB=B3=B8=20=EA=B3=84=EC=A0=95?= =?UTF-8?q?=20=EC=B1=84=EC=9B=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .env.development 의 VITE_DEFAULT_LOGIN_* 로만 채워지고 빌드·테스트엔 안 들어감. 라벨 '비번' → '비밀번호'. Co-Authored-By: Claude Fable 5.1 --- 2_frontend/.env.development | 3 +++ 2_frontend/src/config/env.ts | 7 +++++++ 2_frontend/src/features/auth/components/LoginForm.tsx | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 2_frontend/.env.development diff --git a/2_frontend/.env.development b/2_frontend/.env.development new file mode 100644 index 0000000..7eb643f --- /dev/null +++ b/2_frontend/.env.development @@ -0,0 +1,3 @@ +# 개발 서버 전용 — 로그인 폼 기본값 (5_django_backend 시드 계정). 빌드·테스트엔 안 들어감. +VITE_DEFAULT_LOGIN_EMAIL=admin@codeassist.local +VITE_DEFAULT_LOGIN_PASSWORD=test1234 diff --git a/2_frontend/src/config/env.ts b/2_frontend/src/config/env.ts index 9e033f5..c686438 100644 --- a/2_frontend/src/config/env.ts +++ b/2_frontend/src/config/env.ts @@ -8,11 +8,16 @@ const envSchema = z.object({ z.string().regex(/^\/[^\s]*$/, "must be absolute URL or path starting with '/'"), ]), VITE_ENTRA_GRAPH_SCOPE: z.string().min(1).default("User.Read"), + // 개발 편의 — 로그인 폼 기본값. .env.development 에만 두고 빌드/테스트엔 안 들어감. + VITE_DEFAULT_LOGIN_EMAIL: z.string().default(""), + VITE_DEFAULT_LOGIN_PASSWORD: z.string().default(""), }) export interface AppEnv { apiBaseUrl: string entraGraphScope: string + defaultLoginEmail: string + defaultLoginPassword: string } export function parseEnv(raw: Record): AppEnv { @@ -20,6 +25,8 @@ export function parseEnv(raw: Record): AppEnv { return { apiBaseUrl: parsed.VITE_API_BASE_URL, entraGraphScope: parsed.VITE_ENTRA_GRAPH_SCOPE, + defaultLoginEmail: parsed.VITE_DEFAULT_LOGIN_EMAIL, + defaultLoginPassword: parsed.VITE_DEFAULT_LOGIN_PASSWORD, } } diff --git a/2_frontend/src/features/auth/components/LoginForm.tsx b/2_frontend/src/features/auth/components/LoginForm.tsx index 12806ef..0542653 100644 --- a/2_frontend/src/features/auth/components/LoginForm.tsx +++ b/2_frontend/src/features/auth/components/LoginForm.tsx @@ -11,6 +11,7 @@ import { useLogin } from "../hooks/useLogin" import { safeRedirectPath } from "../utils/safeRedirectPath" import { ApiError } from "@/lib/api/errors" import type { LoginRequest } from "@/types/api" +import { env } from "@/config/env" export default function LoginForm() { const { @@ -19,7 +20,8 @@ export default function LoginForm() { formState: { errors }, } = useForm({ resolver: zodResolver(loginSchema), - defaultValues: { email: "", password: "" }, + // 개발 서버에선 .env.development 의 기본 계정이 채워져 있어 버튼만 누르면 됨 + defaultValues: { email: env.defaultLoginEmail, password: env.defaultLoginPassword }, }) const login = useLogin() const navigate = useNavigate() @@ -53,7 +55,7 @@ export default function LoginForm() { {errors.email &&

{errors.email.message}

}
- +