Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ba75275

Browse files
committed
fix ["Successfully login as undefined"] when private_favorites is empty
1 parent 5245886 commit ba75275

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/plugins/leetcode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,10 @@ plugin.signin = function(user, cb) {
499499
plugin.getUser = function(user, cb) {
500500
plugin.getFavorites(function(e, favorites) {
501501
if (!e) {
502+
user.name = favorites.user_name;
502503
const f = favorites.favorites.private_favorites.find(f => f.name === 'Favorite');
503504
if (f) {
504505
user.hash = f.id_hash;
505-
user.name = favorites.user_name;
506506
} else {
507507
log.warn('Favorite not found?');
508508
}

0 commit comments

Comments
 (0)