Skip to content
Open
Changes from all commits
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
2 changes: 1 addition & 1 deletion scripts/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const upload = (
cb = undefined,
) => {
// To validate user, load user object from GitHub.
const URL = `https://api.github.com/repos/${hook}/contents/${directory}/${filename}`;
const URL = `https://api.github.com/repos/${hook}/contents/${difficulty}/${directory}/${filename}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put a check that difficulty is assigned, and if not - I'd print out some kind of error, or log it somehow. You're working with the globally set variable, it'll help to ensure it's initialized.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please help to check the above comment @samipsuwal?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NikitaShkaruba @karankap00r adding an if-else is making the code async, due to which URL is not being instantiated on time.
Adding a log isn't difficult,
However, in addition to that, a proper solution would be to wrap the if-else in an asynchronous call and continue the rest of the code of the function in the callback.
I might not be understanding something here. wdy think?


/* Define Payload */
let data = {
Expand Down