fix:解决登录过期点击重新登录失败的bug

This commit is contained in:
Roe-xin
2026-03-03 14:19:00 +08:00
parent 8f305033f7
commit 3458f6fe23
5 changed files with 41 additions and 19 deletions

View File

@ -159,8 +159,9 @@ export async function activate(context: vscode.ExtensionContext) {
// 注册命令:用户登录
const loginCommand = vscode.commands.registerCommand(
"ic-coder.login",
async () => {
async (options?: { forceReauth?: boolean }) => {
try {
const forceReauth = options?.forceReauth === true;
const session = await vscode.authentication.getSession("iccoder", [], {
createIfNone: false,
});
@ -169,7 +170,7 @@ export async function activate(context: vscode.ExtensionContext) {
: null;
// 会话仍有效时,直接打开聊天面板
if (session && expired !== true) {
if (session && expired === false && !forceReauth) {
vscode.commands.executeCommand("ic-coder.openChat");
return;
}