Skip to content

fix ["Successfully login as undefined"] when private_favorites is empty #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix ["Successfully login as undefined"] when private_favorites is empty
  • Loading branch information
sunznx committed Dec 5, 2019
commit ba75275bf334ab52017b54044a1df1e07143fc87
2 changes: 1 addition & 1 deletion lib/plugins/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,10 @@ plugin.signin = function(user, cb) {
plugin.getUser = function(user, cb) {
plugin.getFavorites(function(e, favorites) {
if (!e) {
user.name = favorites.user_name;
const f = favorites.favorites.private_favorites.find(f => f.name === 'Favorite');
if (f) {
user.hash = f.id_hash;
user.name = favorites.user_name;
} else {
log.warn('Favorite not found?');
}
Expand Down