8000 fix(getUserInfo): using userStatus.isPremium · soraliu/leetcode-cli@6ab87be · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ab87be

Browse files
committed
fix(getUserInfo): using userStatus.isPremium
1 parent cd5d4ef commit 6ab87be

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/plugins/leetcode.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ plugin.getUserInfo = function(cb) {
408408
'{',
409409
' user {',
410410
' username',
411-
' isCurrentUserPremium',
411+
' }',
412+
' userStatus {',
413+
' isPremium',
412414
' }',
413415
'}'
414416
].join('\n'),
@@ -422,7 +424,8 @@ plugin.getUserInfo = function(cb) {
422424
if (e) return cb(e);
423425

424426
const user = body.data.user;
425-
return cb(null, user);
427+
const userStatus = body.data.userStatus;
428+
return cb(null, user, userStatus);
426429
});
427430
};
428431

@@ -514,9 +517,9 @@ plugin.getUser = function(user, cb) {
514517
log.warn('Failed to retrieve user favorites: ' + e);
515518
}
516519

517-
plugin.getUserInfo(function(e, _user) {
520+
plugin.getUserInfo(function(e, _user, _userStatus) {
518521
if (!e) {
519-
user.paid = _user.isCurrentUserPremium;
522+
user.paid = _userStatus.isPremium
520523
user.name = _user.username;
521524
}
522525
session.saveUser(user);

0 commit comments

Comments
 (0)
0