|
|
@@ -36,6 +36,8 @@ export class User {
|
|
|
// 初始化用户信息
|
|
|
if (userInfo != null && isObject(userInfo)) {
|
|
|
this.set(userInfo);
|
|
|
+ } else {
|
|
|
+ this.get()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -44,15 +46,13 @@ export class User {
|
|
|
* @returns Promise<void>
|
|
|
*/
|
|
|
async get() {
|
|
|
- if (this.token != 'Basic ZW5kOmVuZA==') {
|
|
|
- try {
|
|
|
- const res = await getUsersInfo()
|
|
|
- if (res != null) {
|
|
|
- this.set(res);
|
|
|
- }
|
|
|
- } catch (err) {
|
|
|
- this.logout();
|
|
|
+ try {
|
|
|
+ const res = await getUsersInfo()
|
|
|
+ if (res != null) {
|
|
|
+ this.set(res);
|
|
|
}
|
|
|
+ } catch (err) {
|
|
|
+ this.logout();
|
|
|
}
|
|
|
}
|
|
|
|