fix: clear expired auth state before relogin

This commit is contained in:
Roe-xin
2026-03-02 14:51:11 +08:00
parent 5fc0fd2a95
commit f700473967
3 changed files with 44 additions and 11 deletions

View File

@ -176,6 +176,28 @@ export class ICCoderAuthenticationProvider
}
}
/**
* Clear local authentication state without window reload.
* Used by re-login flow when session is expired.
*/
async clearSessionsForRelogin(): Promise<void> {
if (this._sessions.length === 0) {
await clearUserInfo();
return;
}
const removed = [...this._sessions];
this._sessions = [];
await this.saveSessions();
await clearUserInfo();
this._onDidChangeSessions.fire({
added: [],
removed,
changed: [],
});
}
/**
* 生成会话 ID
*/