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),