File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
frontend/src/pages/Layout Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,20 @@ export function Header() {
8989
9090 const handleLogout = ( ) => {
9191 if ( authMode === 'SSO' ) {
92- // SSO 模式:跳转到 OMS 登出
93- window . location . href = `${ OMS_LOGOUT_URL } ?redirect=${ encodeURIComponent ( window . location . href ) } ` ;
92+ // SSO 模式:检查是否配置了有效的登出 URL
93+ const logoutUrl = OMS_LOGOUT_URL ;
94+
95+ // 如果配置的是默认值(内部 service 名称),只清除本地状态
96+ if ( logoutUrl . includes ( 'oms-service' ) || logoutUrl . includes ( 'localhost' ) ) {
97+ console . warn ( 'OMS logout URL not configured or using internal address, skipping redirect' ) ;
98+ setCurrentUser ( null ) ;
99+ setAuthMode ( 'NONE' ) ;
100+ message . success ( t ( 'user.messages.logoutSuccess' ) ) ;
101+ window . location . reload ( ) ;
102+ } else {
103+ // 使用配置的登出 URL
104+ window . location . href = `${ logoutUrl } ?redirect=${ encodeURIComponent ( window . location . href ) } ` ;
105+ }
94106 } else {
95107 // JWT 模式:清除本地 session
96108 localStorage . removeItem ( 'session' ) ;
You can’t perform that action at this time.
0 commit comments