NEXT_PUBLIC_CM_LOGIN_PAGE_URL 삭제 및 common-codes 수정
This commit is contained in:
@@ -9,9 +9,6 @@ export default function AuthLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<html lang="ko">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
// <html>, <body>는 루트 레이아웃(app/layout.tsx)에서 그린다
|
||||
return children;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { CLAIM_NAME, SITE_ID } from "@/src/shared/config/env";
|
||||
import { AUTH_LOGIN_REDIRECT_URL, CLAIM_NAME, SITE_ID } from "@/src/shared/config/env";
|
||||
import { tokenManager } from "@/src/entities/auth/lib/token-manager";
|
||||
import { getRemainingMs } from "@common/auth";
|
||||
import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "./config/env";
|
||||
|
||||
const LOGIN_PAGE_URL =
|
||||
process.env.NEXT_PUBLIC_CM_LOGIN_PAGE_URL || "/auth/login";
|
||||
|
||||
// client 화면인 경우, 토큰 만료여부 점검하여 로그인 페이지로 이동
|
||||
const handleUnauthorizedResponse = () => {
|
||||
if (typeof window === "undefined") return;
|
||||
@@ -23,7 +20,7 @@ const handleUnauthorizedResponse = () => {
|
||||
window.location.pathname.startsWith("/auth/login/");
|
||||
|
||||
if (!isLoginPage) {
|
||||
window.location.assign(LOGIN_PAGE_URL);
|
||||
window.location.assign(AUTH_LOGIN_REDIRECT_URL);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+2
-12
@@ -1,5 +1,4 @@
|
||||
"use client";
|
||||
import { authService } from "@/src/entities/auth";
|
||||
import { useEffect } from "react";
|
||||
import { AUTH_USER_ID } from "@/src/shared/config";
|
||||
import { getCookie } from "@/src/shared/lib/cookie";
|
||||
@@ -14,17 +13,8 @@ export default function Home() {
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") {
|
||||
if (!checkToken) {
|
||||
async function doLogin() {
|
||||
try {
|
||||
await authService.login({ userId: "CLEANWATER", password: "gktneh12!@" });
|
||||
window.location.href = "/pages/dashboard";
|
||||
} catch (err) {
|
||||
console.error("로그인 실패", err);
|
||||
}
|
||||
}
|
||||
doLogin();
|
||||
} else router.push("/pages/dashboard");
|
||||
if (!checkToken) router.push("/auth/login");
|
||||
else router.push("/pages/dashboard");
|
||||
} else router.push("/pages/dashboard");
|
||||
}, []);
|
||||
}
|
||||
Reference in New Issue
Block a user