Skip to content

Commit

Permalink
fix: user refresh use correct api
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Jul 17, 2020
1 parent 09a5991 commit 41e5e31
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/main/service/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export default class UserService extends Service {
let result = await refresh({
accessToken: user.accessToken,
clientToken: this.state.user.clientToken,
});
}, this.getters.authService);
this.log(`Refreshed user access token for user: ${user.id}`);
this.commit('userProfileUpdate', {
id: user.id,
Expand All @@ -287,19 +287,9 @@ export default class UserService extends Service {
selectedProfile: undefined,
});
this.checkLocation();

if (user.authService === 'mojang') {
// try {
// let info = await getAccountInfo(user.accessToken);
// this.commit('userMojangInfo', info);
// } catch (e) {
// this.warn(`Cannot refresh mojang info for user ${user.username}.`);
// this.warn(e);
// }
}
} catch (e) {
this.log(e);
this.log(`Invalid current user ${user.id} accessToken!`);
this.error(e);
this.warn(`Invalid current user ${user.id} accessToken!`);
this.commit('userInvalidate');
}
} else {
Expand All @@ -315,15 +305,15 @@ export default class UserService extends Service {
let {
gameProfileId = this.state.user.selectedUser.profile,
userId = this.state.user.selectedUser.id,
} = o;
} = o ?? {};
return `${userId}[${gameProfileId}]`;
})
async refreshSkin(refreshSkinOptions: RefreshSkinOptions = {}) {
let {
gameProfileId = this.state.user.selectedUser.profile,
userId = this.state.user.selectedUser.id,
force,
} = refreshSkinOptions;
} = refreshSkinOptions ?? {};
let user = this.state.user.users[userId];
let gameProfile = user.profiles[gameProfileId];
// if no game profile (maybe not logined), return
Expand Down

0 comments on commit 41e5e31

Please sign in to comment.