- Gateway 로그인/포탈 페이지 SSO 연동 - System1 web/fastapi-bridge API base URL 동적 설정 - SSO 토큰 기반 인증 흐름 통일 - deprecated JS 파일 삭제 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.5 KiB
JavaScript
52 lines
1.5 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);
|
|
redirect(loginUrl);
|
|
}
|
|
|
|
/**
|
|
* 사용자의 기본 대시보드 페이지로 리디렉션합니다.
|
|
* 백엔드가 지정한 URL이 있으면 그곳으로, 없으면 기본 URL로 이동합니다.
|
|
* @param {string} [backendRedirectUrl=null] - 백엔드에서 전달받은 리디렉션 URL
|
|
*/
|
|
export function redirectToDefaultDashboard(backendRedirectUrl = null) {
|
|
const destination = backendRedirectUrl || config.paths.defaultDashboard;
|
|
|
|
// 부드러운 화면 전환 효과
|
|
document.body.style.transition = 'opacity 0.3s ease-out';
|
|
document.body.style.opacity = '0';
|
|
|
|
setTimeout(() => {
|
|
redirect(destination);
|
|
}, 300);
|
|
}
|
|
|
|
/**
|
|
* 시스템 대시보드 페이지로 리디렉션합니다.
|
|
*/
|
|
export function redirectToSystemDashboard() {
|
|
redirect(config.paths.systemDashboard);
|
|
}
|
|
|
|
/**
|
|
* 그룹 리더 대시보드 페이지로 리디렉션합니다.
|
|
*/
|
|
export function redirectToGroupLeaderDashboard() {
|
|
redirect(config.paths.groupLeaderDashboard);
|
|
}
|
|
|
|
// 필요에 따라 더 많은 리디렉션 함수를 추가할 수 있습니다.
|
|
// export function redirectToUserProfile() { ... }
|