SSE鉴权失效停止重连清理会话跳登录并降噪4xx错误日志
This commit is contained in:
@@ -87,6 +87,11 @@ export default function AdminLayout() {
|
||||
url: '/api/v1/admin/realtime',
|
||||
token: getAdminToken(),
|
||||
onEvent: (event) => applyAdminRealtimeEvent(event, queryClient),
|
||||
// 会话过期时清登录态回登录页,避免 SSE 带着失效 token 无限重连刷 401。
|
||||
onAuthExpired: () => {
|
||||
clearAdminSession()
|
||||
void navigate('/admin/login', { replace: true, state: { from: location } })
|
||||
},
|
||||
})
|
||||
|
||||
const menuItems = useMemo<MenuProps['items']>(() => {
|
||||
@@ -541,12 +546,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
}
|
||||
|
||||
type NotificationAlertKind =
|
||||
| 'withdraw'
|
||||
| 'recharge'
|
||||
| 'acceptance'
|
||||
| 'material'
|
||||
| 'reminder'
|
||||
| 'default'
|
||||
'withdraw' | 'recharge' | 'acceptance' | 'material' | 'reminder' | 'default'
|
||||
|
||||
function playNotificationSound(kind: NotificationAlertKind) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user