fix: update login error

This commit is contained in:
2025-03-23 12:17:06 +08:00
parent 4b16ec8499
commit d56c4c15f2
8 changed files with 25 additions and 55 deletions

View File

@@ -65,7 +65,10 @@ const loginCommand = new Command('login')
program.addCommand(loginCommand);
const showMe = async (show = true) => {
const me = await queryLogin.getMe();
let me = await queryLogin.getMe();
if (me.code === 401) {
me = await queryLogin.getMe();
}
if (show) {
console.log('Me', me.data);
}
@@ -84,7 +87,12 @@ const switchOrgCommand = new Command('switch').argument('<username>', 'Switch to
program.addCommand(switchOrgCommand);
const command = new Command('me').description('').action(async () => {
await showMe();
try {
const res = await showMe(false);
console.log('me', res?.data);
} catch (error) {
console.log('me error', error);
}
});
program.addCommand(command);