@42ailab/42plugin 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@42ailab/42plugin",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "活水插件",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -66,7 +66,7 @@ async function login(): Promise<void> {
66
66
 
67
67
  const tokenResponse = await api.pollDeviceToken(deviceCode.deviceCode);
68
68
 
69
- if (tokenResponse.accessToken && tokenResponse.user) {
69
+ if (tokenResponse.accessToken) {
70
70
  pollSpinner.succeed('授权成功!');
71
71
 
72
72
  // 保存 token
@@ -74,7 +74,12 @@ async function login(): Promise<void> {
74
74
  api.setSessionToken(tokenResponse.accessToken);
75
75
 
76
76
  console.log();
77
- console.log(chalk.green(`欢迎,${tokenResponse.user.name || tokenResponse.user.username || tokenResponse.user.email}!`));
77
+ try {
78
+ const session = await api.getSession();
79
+ console.log(chalk.green(`欢迎,${session.user.name || session.user.username || session.user.email}!`));
80
+ } catch {
81
+ console.log(chalk.green('授权成功!'));
82
+ }
78
83
  return;
79
84
  }
80
85