fix: update login error
This commit is contained in:
parent
4b16ec8499
commit
d56c4c15f2
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/envision-cli",
|
"name": "@kevisual/envision-cli",
|
||||||
"version": "0.0.33",
|
"version": "0.0.34",
|
||||||
"description": "envision command tools",
|
"description": "envision command tools",
|
||||||
"main": "dist/app.mjs",
|
"main": "dist/app.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -33,7 +33,7 @@
|
|||||||
],
|
],
|
||||||
"author": "abearxiong",
|
"author": "abearxiong",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kevisual/query": "0.0.13",
|
"@kevisual/query": "0.0.15",
|
||||||
"@kevisual/query-login": "workspace:*",
|
"@kevisual/query-login": "workspace:*",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-commonjs": "^28.0.3",
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
|
25
pnpm-lock.yaml
generated
25
pnpm-lock.yaml
generated
@ -37,8 +37,8 @@ importers:
|
|||||||
version: 6.2.2(@types/node@22.13.11)
|
version: 6.2.2(@types/node@22.13.11)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@kevisual/query':
|
'@kevisual/query':
|
||||||
specifier: 0.0.13
|
specifier: 0.0.15
|
||||||
version: 0.0.13(encoding@0.1.13)(ws@8.18.0)
|
version: 0.0.15(encoding@0.1.13)(ws@8.18.0)
|
||||||
'@kevisual/query-login':
|
'@kevisual/query-login':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:submodules/kevisual-query-login
|
version: link:submodules/kevisual-query-login
|
||||||
@ -118,8 +118,8 @@ importers:
|
|||||||
specifier: ^0.0.1
|
specifier: ^0.0.1
|
||||||
version: 0.0.1(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2)
|
version: 0.0.1(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2)
|
||||||
'@kevisual/query':
|
'@kevisual/query':
|
||||||
specifier: ^0.0.12
|
specifier: ^0.0.15
|
||||||
version: 0.0.12(encoding@0.1.13)(ws@8.18.0)
|
version: 0.0.15(encoding@0.1.13)(ws@8.18.0)
|
||||||
dotenv:
|
dotenv:
|
||||||
specifier: ^16.4.7
|
specifier: ^16.4.7
|
||||||
version: 16.4.7
|
version: 16.4.7
|
||||||
@ -447,11 +447,8 @@ packages:
|
|||||||
'@kevisual/load@0.0.6':
|
'@kevisual/load@0.0.6':
|
||||||
resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==}
|
resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==}
|
||||||
|
|
||||||
'@kevisual/query@0.0.12':
|
'@kevisual/query@0.0.15':
|
||||||
resolution: {integrity: sha512-/1lZJhNCdcNG4a2Nncl55XC/nha5+GZiJPQdP77lufv2dnZfcssA7NHSZ2Ubh0Pm0HWV22IiGfQMiaYl2pkK1Q==}
|
resolution: {integrity: sha512-DK41qvyOiJMmlj70QyVP/48M0gszA39DdnBLtgU94YwAe6OqKrr9tYXHLjZrOROmUVMezIIBQuWMLedSAvb54A==}
|
||||||
|
|
||||||
'@kevisual/query@0.0.13':
|
|
||||||
resolution: {integrity: sha512-gSEIDiCvwSaLLAFZv4vam4wSrMsaCuQ3VGjE3kwRwZ8urlVH1TOA+NUO908A22p9m1Iij7Y1Q/JlfSJi2QzuKQ==}
|
|
||||||
|
|
||||||
'@kevisual/router@0.0.9':
|
'@kevisual/router@0.0.9':
|
||||||
resolution: {integrity: sha512-qPyC2GVJ7iOIdJCCKNDsWMAKOQeSJW9HBpL5ZWKHTbi+t4jJBGTzIlXmjKeMHRd0lr/Qq1imQvlkSh4hlrbodA==}
|
resolution: {integrity: sha512-qPyC2GVJ7iOIdJCCKNDsWMAKOQeSJW9HBpL5ZWKHTbi+t4jJBGTzIlXmjKeMHRd0lr/Qq1imQvlkSh4hlrbodA==}
|
||||||
@ -2244,15 +2241,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
eventemitter3: 5.0.1
|
eventemitter3: 5.0.1
|
||||||
|
|
||||||
'@kevisual/query@0.0.12(encoding@0.1.13)(ws@8.18.0)':
|
'@kevisual/query@0.0.15(encoding@0.1.13)(ws@8.18.0)':
|
||||||
dependencies:
|
|
||||||
openai: 4.88.0(encoding@0.1.13)(ws@8.18.0)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- encoding
|
|
||||||
- ws
|
|
||||||
- zod
|
|
||||||
|
|
||||||
'@kevisual/query@0.0.13(encoding@0.1.13)(ws@8.18.0)':
|
|
||||||
dependencies:
|
dependencies:
|
||||||
openai: 4.88.0(encoding@0.1.13)(ws@8.18.0)
|
openai: 4.88.0(encoding@0.1.13)(ws@8.18.0)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
@ -65,7 +65,10 @@ const loginCommand = new Command('login')
|
|||||||
program.addCommand(loginCommand);
|
program.addCommand(loginCommand);
|
||||||
|
|
||||||
const showMe = async (show = true) => {
|
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) {
|
if (show) {
|
||||||
console.log('Me', me.data);
|
console.log('Me', me.data);
|
||||||
}
|
}
|
||||||
@ -84,7 +87,12 @@ const switchOrgCommand = new Command('switch').argument('<username>', 'Switch to
|
|||||||
program.addCommand(switchOrgCommand);
|
program.addCommand(switchOrgCommand);
|
||||||
|
|
||||||
const command = new Command('me').description('').action(async () => {
|
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);
|
program.addCommand(command);
|
||||||
|
@ -12,7 +12,7 @@ const tokenList = new Command('list')
|
|||||||
.description('show token list')
|
.description('show token list')
|
||||||
// .option('-r --remove <number>', 'remove token by number')
|
// .option('-r --remove <number>', 'remove token by number')
|
||||||
.action(async (opts) => {
|
.action(async (opts) => {
|
||||||
const res = queryLogin.cache.cache.cacheData;
|
const res = queryLogin.cacheStore.cacheData;
|
||||||
console.log(util.inspect(res, { colors: true, depth: 4 }));
|
console.log(util.inspect(res, { colors: true, depth: 4 }));
|
||||||
});
|
});
|
||||||
token.addCommand(tokenList);
|
token.addCommand(tokenList);
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
import { program as app, Command } from '@/program.ts';
|
|
||||||
import { getConfig, writeConfig } from '@/module/index.ts';
|
|
||||||
import {queryMe} from '../query/index.ts';
|
|
||||||
|
|
||||||
|
|
||||||
// const command = new Command('me')
|
|
||||||
// .description('')
|
|
||||||
// .action(async () => {
|
|
||||||
// const config = getConfig()
|
|
||||||
// const res = await queryMe();
|
|
||||||
// if(res.code===200) {
|
|
||||||
// console.log('me', res.data)
|
|
||||||
// } else {
|
|
||||||
// console.log('not login')
|
|
||||||
// writeConfig({ ...config, token: '' });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// app.addCommand(command);
|
|
@ -2,7 +2,6 @@ import { program } from '@/program.ts';
|
|||||||
import './command/login.ts';
|
import './command/login.ts';
|
||||||
import './command/logout.ts';
|
import './command/logout.ts';
|
||||||
import './command/ls-token.ts';
|
import './command/ls-token.ts';
|
||||||
import './command/me.ts';
|
|
||||||
import './command/deploy.ts';
|
import './command/deploy.ts';
|
||||||
import './command/serve.ts';
|
import './command/serve.ts';
|
||||||
import './command/config.ts';
|
import './command/config.ts';
|
||||||
|
@ -34,20 +34,13 @@ query.beforeRequest = async (config) => {
|
|||||||
};
|
};
|
||||||
query.afterResponse = async (response, ctx) => {
|
query.afterResponse = async (response, ctx) => {
|
||||||
if (response.code === 401) {
|
if (response.code === 401) {
|
||||||
if (query.stop) {
|
console.log('401 after', response);
|
||||||
return {
|
|
||||||
code: 500,
|
|
||||||
message: '登录已过期',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
query.stop = true;
|
|
||||||
const res = await queryLogin.afterCheck401ToRefreshToken(response, ctx);
|
|
||||||
query.stop = false;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
return response as any;
|
return response as any;
|
||||||
};
|
};
|
||||||
export const queryLogin = new QueryLoginNode({
|
export const queryLogin = new QueryLoginNode({
|
||||||
query: query as any,
|
query: query as any,
|
||||||
onLoad: async () => {},
|
onLoad: async () => {
|
||||||
|
// console.log('onLoad');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit af8ed90ab3f5a0b558c410f5a0f40d5fb7eaa6d6
|
Subproject commit 54672a5574d359220e26ec17c69f567f130d9498
|
Loading…
x
Reference in New Issue
Block a user