feat: 登录过期自动续登并校验同一账号
This commit is contained in:
@@ -2,12 +2,17 @@ import { Component, PropsWithChildren } from 'react'
|
||||
import { ThemeProvider } from './context/ThemeContext'
|
||||
import { getTheme, resolveTheme } from './utils/store'
|
||||
import { applyPageBackground } from './utils/themeBackground'
|
||||
import { setSessionRefreshHandler } from './utils/request'
|
||||
import { refreshSession, ensureSessionFresh } from './utils/session'
|
||||
import './app.scss'
|
||||
|
||||
class App extends Component<PropsWithChildren> {
|
||||
componentDidMount() {
|
||||
// 启动最早时机同步页面背景,避免自定义导航区在深色模式下闪白
|
||||
applyPageBackground(resolveTheme(getTheme()))
|
||||
// 全局 401 自动续登 + 启动时主动校验登录态
|
||||
setSessionRefreshHandler(refreshSession)
|
||||
ensureSessionFresh()
|
||||
}
|
||||
|
||||
componentDidShow() {}
|
||||
|
||||
Reference in New Issue
Block a user