@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 +1 -1
- package/src/commands/auth.ts +7 -2
package/package.json
CHANGED
package/src/commands/auth.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|