fix: fo 로그아웃 로직 수정
This commit is contained in:
+13
-18
@@ -11,25 +11,20 @@ export default function Home() {
|
||||
const checkToken = getCookie(AUTH_USER_ID);
|
||||
|
||||
useEffect(() => {
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
if (!checkToken) {
|
||||
// 외부 URL로 이동해야 할 경우 location.replace를 사용합니다.
|
||||
if (window.location.hostname.includes("hasuon.or.kr")) {
|
||||
location.replace(process.env.NEXT_PUBLIC_CM_LOGIN_PAGE_URL||'/pages/dashboard');
|
||||
return; // 페이지 이동 후에는 더 이상 로직을 실행하지 않습니다.
|
||||
}
|
||||
|
||||
async function doLogin() {
|
||||
try {
|
||||
await LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" });
|
||||
router.push("/pages/dashboard"); // location.href 대신 router.push 사용
|
||||
} catch (err) {
|
||||
console.error("로그인 실패", err);
|
||||
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "con.mind-one.co.kr") {
|
||||
if (!checkToken) {
|
||||
async function doLogin() {
|
||||
try {
|
||||
await LoginApi.login({ userId: "CLEANWATER", password: "gktneh12!@" });
|
||||
window.location.href = "/pages/dashboard";
|
||||
} catch (err) {
|
||||
console.error("로그인 실패", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
doLogin();
|
||||
} else {
|
||||
router.push("/pages/dashboard");
|
||||
}
|
||||
doLogin();
|
||||
} else router.push("/pages/dashboard");
|
||||
} else router.push("/pages/dashboard");
|
||||
}, []);
|
||||
}
|
||||
Reference in New Issue
Block a user