From 21af492743e9091da8ecebd2ff5a5fe57a75579d Mon Sep 17 00:00:00 2001 From: yschoi Date: Sun, 10 Aug 2025 22:32:10 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20layout=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/fo/app/layout.tsx | 12 +++++++++++- apps/fo/app/store/store.tsx | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/fo/app/layout.tsx b/apps/fo/app/layout.tsx index af0725a7b..842ec5ed1 100644 --- a/apps/fo/app/layout.tsx +++ b/apps/fo/app/layout.tsx @@ -1,17 +1,27 @@ "use client" import "./globals.css"; import { StoreProvider } from "./store"; +import { LoginApi } from "@/src/entities/auth"; +import { useEffect } from "react"; export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { + + useEffect(() => { + // 렌더 중이 아니라 클라이언트에서만 실행 + 에러 캐치 + void LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" }) + .catch((e) => { + console.error("Auto login failed:", e); + }); + }, []); return ( - {children} + {children} diff --git a/apps/fo/app/store/store.tsx b/apps/fo/app/store/store.tsx index 589bc4d78..f7f2222c6 100644 --- a/apps/fo/app/store/store.tsx +++ b/apps/fo/app/store/store.tsx @@ -1,4 +1,3 @@ -import { LoginApi } from '@/src/entities/auth/api/login-service'; import { createStore } from 'zustand/vanilla'; import { CommonReducer, commonState, type CommonStore, type CommonType } from './common'; import { dashBoardInitState, dashBoardReducer, type DashBoardStore, type DashBoardType } from './dashboard'; @@ -59,7 +58,6 @@ export const StoreZus = } ) => { return createStore()((set) => { - LoginApi.login({userId: "CLEANWATER", password: "gktneh12!@"}) return { ...initState, ...CommonReducer(set),