- config.js loginPage를 /index.html에서 /login(SSO)으로 변경 - navigation.js, load-navbar.js에 redirect 파라미터 추가 - 8개 JS 파일의 하드코딩된 '/login' → window.getLoginUrl() 전환 - 로그아웃 시 clearSSOAuth() 호출 추가 (SSO 쿠키 삭제) - api-base.js v=2→v=3 (SW 캐시 해제 코드 통합) - TBM 모듈 버전 쿼리스트링 통일 (tbm.html, tbm-mobile.html) - dashboard.html SW 캐시 해제 인라인 코드 제거 (api-base.js에서 처리) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
// /js/navigation.js
|
|
import { config } from './config.js';
|
|
|
|
/**
|
|
* 지정된 URL로 페이지를 리디렉션합니다.
|
|
* @param {string} url - 이동할 URL
|
|
*/
|
|
function redirect(url) {
|
|
window.location.href = url;
|
|
}
|
|
|
|
/**
|
|
* 로그인 페이지로 리디렉션합니다.
|
|
*/
|
|
export function redirectToLogin() {
|
|
const loginUrl = config.paths.loginPage + '?redirect=' + encodeURIComponent(window.location.href);
|
|
console.log(`🔄 로그인 페이지로 이동합니다: ${loginUrl}`);
|
|
redirect(loginUrl);
|
|
}
|
|
|
|
/**
|
|
* 사용자의 기본 대시보드 페이지로 리디렉션합니다.
|
|
* 백엔드가 지정한 URL이 있으면 그곳으로, 없으면 기본 URL로 이동합니다.
|
|
* @param {string} [backendRedirectUrl=null] - 백엔드에서 전달받은 리디렉션 URL
|
|
*/
|
|
export function redirectToDefaultDashboard(backendRedirectUrl = null) {
|
|
const destination = backendRedirectUrl || config.paths.defaultDashboard;
|
|
console.log(`🔄 대시보드로 이동합니다: ${destination}`);
|
|
|
|
// 부드러운 화면 전환 효과
|
|
document.body.style.transition = 'opacity 0.3s ease-out';
|
|
document.body.style.opacity = '0';
|
|
|
|
setTimeout(() => {
|
|
redirect(destination);
|
|
}, 300);
|
|
}
|
|
|
|
/**
|
|
* 시스템 대시보드 페이지로 리디렉션합니다.
|
|
*/
|
|
export function redirectToSystemDashboard() {
|
|
console.log(`🔄 시스템 대시보드로 이동합니다: ${config.paths.systemDashboard}`);
|
|
redirect(config.paths.systemDashboard);
|
|
}
|
|
|
|
/**
|
|
* 그룹 리더 대시보드 페이지로 리디렉션합니다.
|
|
*/
|
|
export function redirectToGroupLeaderDashboard() {
|
|
console.log(`🔄 그룹 리더 대시보드로 이동합니다: ${config.paths.groupLeaderDashboard}`);
|
|
redirect(config.paths.groupLeaderDashboard);
|
|
}
|
|
|
|
// 필요에 따라 더 많은 리디렉션 함수를 추가할 수 있습니다.
|
|
// export function redirectToUserProfile() { ... }
|